1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-17704: ldap_search fails when $attributes contains a non-packed array with numerical keys

Closes GH-17710.
This commit is contained in:
Niels Dossche
2025-02-05 19:45:09 +01:00
parent 68d2bc42fc
commit 2fb88b2d80
3 changed files with 29 additions and 1 deletions

4
NEWS
View File

@@ -12,6 +12,10 @@ PHP NEWS
zend.exception_ignore_args=1 into account). (timwolla)
. Fix fallback paths in fast_long_{add,sub}_function. (nielsdos)
- LDAP:
. Fixed bug GH-17704 (ldap_search fails when $attributes contains a
non-packed array with numerical keys). (nielsdos, 7u83)
- MBString:
. Fixed bug GH-17503 (Undefined float conversion in mb_convert_variables).
(cmb)

View File

@@ -248,7 +248,7 @@ static bool php_ldap_is_numerically_indexed_array(zend_array *arr)
}
} ZEND_HASH_FOREACH_END();
return false;
return true;
}
/* {{{ Parse controls from and to arrays */

View File

@@ -0,0 +1,24 @@
--TEST--
GH-17704 (ldap_search fails when $attributes contains a non-packed array with numerical keys)
--EXTENSIONS--
ldap
--SKIPIF--
<?php
require_once('skipifbindfailure.inc');
?>
--FILE--
<?php
include "connect.inc";
$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
$attributes = ["uid", "cn"];
// force a non-packed array
$attributes["x"] = "x";
unset($attributes["x"]);
var_dump(ldap_search($link, $base, "(o=*)", $attributes));
?>
--EXPECTF--
object(LDAP\Result)#%d (0) {
}