summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2017-01-17 15:34:19 +0800
committerXinchen Hui <laruence@gmail.com>2017-01-17 15:34:19 +0800
commitb28c2e20ca83ffb5dc9159d7d03f0baf55b0aeaf (patch)
treefb0373f57714aaa480c860c73bb35c89971e98b2
parente0ca519a8ba9afa1cb7531187050e599af4d7d90 (diff)
downloadphp-git-b28c2e20ca83ffb5dc9159d7d03f0baf55b0aeaf.tar.gz
Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache)
-rw-r--r--NEWS4
-rw-r--r--ext/ldap/ldap.c3
-rw-r--r--ext/ldap/tests/bug73933.phpt20
3 files changed, 26 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index ce4a7482d4..5328c66411 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ PHP NEWS
. Fixed bug #69993 (test for gmp.h needs to test machine includes).
(Jordan Gigov)
+- LDAP:
+ . Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache).
+ (Laruence)
+
- Mysqlnd:
. Fixed bug #69899 (segfault on close() after free_result() with mysqlnd).
(Richard Fussenegger)
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 4068384d0f..0fb9c755aa 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1427,7 +1427,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
zend_ulong index;
int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &link, &dn, &dn_len, &entry) != SUCCESS) {
return;
}
@@ -1475,6 +1475,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
if (Z_TYPE_P(value) != IS_ARRAY) {
num_values = 1;
} else {
+ SEPARATE_ARRAY(value);
num_values = zend_hash_num_elements(Z_ARRVAL_P(value));
}
diff --git a/ext/ldap/tests/bug73933.phpt b/ext/ldap/tests/bug73933.phpt
new file mode 100644
index 0000000000..6bf4c078e3
--- /dev/null
+++ b/ext/ldap/tests/bug73933.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #73933 (error/segfault with ldap_mod_replace and opcache)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+/* We are assuming 3333 is not connectable */
+$ldap = ldap_connect('127.0.0.1', 3333);
+
+ldap_mod_replace($ldap, null, array(
+ 'lockoutTime' => array(0),
+));
+
+ldap_close($ldap);
+
+?>
+--EXPECTF--
+Warning: ldap_mod_replace(): Modify: Can't contact LDAP server in %sbug73933.php on line %d