Skip to content

Commit e180e45

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache)
2 parents 05f2f73 + b28c2e2 commit e180e45

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

ext/ldap/ldap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
14761476
zend_ulong index;
14771477
int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
14781478

1479-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) {
1479+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &link, &dn, &dn_len, &entry) != SUCCESS) {
14801480
return;
14811481
}
14821482

@@ -1524,6 +1524,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
15241524
if (Z_TYPE_P(value) != IS_ARRAY) {
15251525
num_values = 1;
15261526
} else {
1527+
SEPARATE_ARRAY(value);
15271528
num_values = zend_hash_num_elements(Z_ARRVAL_P(value));
15281529
}
15291530

ext/ldap/tests/bug73933.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #73933 (error/segfault with ldap_mod_replace and opcache)
3+
--SKIPIF--
4+
<?php
5+
require_once('skipif.inc');
6+
?>
7+
--FILE--
8+
<?php
9+
/* We are assuming 3333 is not connectable */
10+
$ldap = ldap_connect('127.0.0.1', 3333);
11+
12+
ldap_mod_replace($ldap, null, array(
13+
'lockoutTime' => array(0),
14+
));
15+
16+
ldap_close($ldap);
17+
18+
?>
19+
--EXPECTF--
20+
Warning: ldap_mod_replace(): Modify: Can't contact LDAP server in %sbug73933.php on line %d

0 commit comments

Comments
 (0)