]> granicus.if.org Git - php/commitdiff
Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache)
authorXinchen Hui <laruence@gmail.com>
Tue, 17 Jan 2017 07:34:19 +0000 (15:34 +0800)
committerXinchen Hui <laruence@gmail.com>
Tue, 17 Jan 2017 07:34:19 +0000 (15:34 +0800)
NEWS
ext/ldap/ldap.c
ext/ldap/tests/bug73933.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index ce4a7482d4e0816881e7238b933d8630aea00426..5328c6641114f0e9c67658d5fc25aef4630e10dd 100644 (file)
--- 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)
index 4068384d0f076aca6e9b24b33d9ed32a5e4aa229..0fb9c755aa82d0a45299c237bfb51397785b47f0 100644 (file)
@@ -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 (file)
index 0000000..6bf4c07
--- /dev/null
@@ -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