com php-src: Fixed bug #73933 (error/segfault with ldap_mod _replace and opcache): NEWS ext/ldap/ldap.c e xt/ldap/tests/bug73933.phpt
| From: | Xinchen Hui | Date: | Tue, 17 Jan 2017 07:34:19 +0000 |
| Subject: | com php-src: Fixed bug #73933 (error/segfault with ldap_mod _replace and opcache): NEWS ext/ldap/ldap.c e xt/ldap/tests/bug73933.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96758@lists.php.net to get a copy of this message | ||
Commit: b28c2e20ca83ffb5dc9159d7d03f0baf55b0aeaf
Author: Xinchen Hui <laruence@gmail.com> Tue, 17 Jan 2017 15:34:19 +0800
Parents: e0ca519a8ba9afa1cb7531187050e599af4d7d90
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b28c2e20ca83ffb5dc9159d7d03f0baf55b0aeaf
Log:
Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache)
Bugs:
https://bugs.php..net/73933
Changed paths:
M NEWS
M ext/ldap/ldap.c
A ext/ldap/tests/bug73933.phpt
Diff:
diff --git a/NEWS b/NEWS
index ce4a748..5328c66 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 4068384..0fb9c75 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 0000000..6bf4c07
--- /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