Skip to content

Commit ac40d0f

Browse files
committed
Don't modify arrays passed by value
1 parent beb7a00 commit ac40d0f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
@ldap_read(null, null, null, $array);
11+
var_dump($array);
12+
?>
13+
--EXPECT--
14+
array(3) {
15+
[0]=>
16+
int(123)
17+
[1]=>
18+
int(456)
19+
[2]=>
20+
int(789)
21+
}

0 commit comments

Comments
 (0)