com php-src: Don't modify arrays passed by value: ext/ldap/ldap.c ext/ldap/tests/ldap_read_variation1.phpt
| From: | Christoph Michael Becker | Date: | Sun, 25 Aug 2019 16:27:35 +0000 |
| Subject: | com php-src: Don't modify arrays passed by value: ext/ldap/ldap.c ext/ldap/tests/ldap_read_variation1.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108037@lists.php.net to get a copy of this message | ||
Commit: ac40d0ffbca2a8c941c748ace7528b4699b307fc
Author: Christoph M. Becker <cmbecker69@gmx.de> Sat, 24 Aug 2019 10:28:43 +0200
Parents: beb7a0039b21dbf61ece820dca837e106af9a48f
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ac40d0ffbca2a8c941c748ace7528b4699b307fc
Log:
Don't modify arrays passed by value
Changed paths:
M ext/ldap/ldap.c
A ext/ldap/tests/ldap_read_variation1.phpt
Diff:
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 15cd0c3..44c9e2f 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1480,7 +1480,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
int old_ldap_sizelimit = -1, old_ldap_timelimit = -1, old_ldap_deref = -1;
int num_attribs = 0, ret = 1, i, errno, argcount = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argcount, "zzz|alllla/", &link, &base_dn, &filter,
&attrs, &attrsonly,
+ if (zend_parse_parameters(argcount, "zzz|a/lllla/", &link, &base_dn,
&filter, &attrs, &attrsonly,
&sizelimit, &timelimit, &deref, &serverctrls) == FAILURE) {
return;
}
diff --git a/ext/ldap/tests/ldap_read_variation1.phpt b/ext/ldap/tests/ldap_read_variation1.phpt
new file mode 100644
index 0000000..907d9ae
--- /dev/null
+++ b/ext/ldap/tests/ldap_read_variation1.phpt
@@ -0,0 +1,21 @@
+--TEST--
+ldap_read() does not modify $attributes array
+--SKIPIF--
+<?php
+if (!extension_loaded('ldap')) die('ldap extension not available');
+?>
+--FILE--
+<?php
+$array = [123, 456, 789];
+@ldap_read(null, null, null, $array);
+var_dump($array);
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ int(123)
+ [1]=>
+ int(456)
+ [2]=>
+ int(789)
+}