Skip to content

Commit 6cd821b

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Don't modify arrays passed by value
2 parents 64d0416 + ac40d0f commit 6cd821b

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ext/ldap/ldap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
14801480
int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1;
14811481
int num_attribs = 0, ret = 1, i, errno, argcount = ZEND_NUM_ARGS();
14821482

1483-
if (zend_parse_parameters(argcount, "zzz|alllla/", &link, &base_dn, &filter, &attrs, &attrsonly,
1483+
if (zend_parse_parameters(argcount, "zzz|a/lllla/", &link, &base_dn, &filter, &attrs, &attrsonly,
14841484
&sizelimit, &timelimit, &deref, &serverctrls) == FAILURE) {
14851485
return;
14861486
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
ldap_read() does not modify $attributes array
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('ldap')) die('ldap extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$array = [123, 456, 789];
10+
try {
11+
ldap_read(null, null, null, $array);
12+
} catch (TypeError $err) {}
13+
var_dump($array);
14+
?>
15+
--EXPECT--
16+
array(3) {
17+
[0]=>
18+
int(123)
19+
[1]=>
20+
int(456)
21+
[2]=>
22+
int(789)
23+
}

0 commit comments

Comments
 (0)