Skip to content

Commit b28c2e2

Browse files
committed
Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache)
1 parent e0ca519 commit b28c2e2

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ PHP NEWS
1616
. Fixed bug #69993 (test for gmp.h needs to test machine includes).
1717
(Jordan Gigov)
1818

19+
- LDAP:
20+
. Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache).
21+
(Laruence)
22+
1923
- Mysqlnd:
2024
. Fixed bug #69899 (segfault on close() after free_result() with mysqlnd).
2125
(Richard Fussenegger)

ext/ldap/ldap.c

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

1430-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &link, &dn, &dn_len, &entry) != SUCCESS) {
1430+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &link, &dn, &dn_len, &entry) != SUCCESS) {
14311431
return;
14321432
}
14331433

@@ -1475,6 +1475,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
14751475
if (Z_TYPE_P(value) != IS_ARRAY) {
14761476
num_values = 1;
14771477
} else {
1478+
SEPARATE_ARRAY(value);
14781479
num_values = zend_hash_num_elements(Z_ARRVAL_P(value));
14791480
}
14801481

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)