Skip to content

Commit e3a2306

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-17704: ldap_search fails when $attributes contains a non-packed array with numerical keys
2 parents 4ac2c36 + 2fb88b2 commit e3a2306

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ PHP NEWS
2222
. Fixed bug GH-17703 (imagescale with both width and height negative values
2323
triggers only an Exception on width). (David Carlier)
2424

25+
- LDAP:
26+
. Fixed bug GH-17704 (ldap_search fails when $attributes contains a
27+
non-packed array with numerical keys). (nielsdos, 7u83)
28+
2529
- MBString:
2630
. Fixed bug GH-17503 (Undefined float conversion in mb_convert_variables).
2731
(cmb)

ext/ldap/ldap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ static bool php_ldap_is_numerically_indexed_array(zend_array *arr)
247247
}
248248
} ZEND_HASH_FOREACH_END();
249249

250-
return false;
250+
return true;
251251
}
252252

253253
/* {{{ Parse controls from and to arrays */

ext/ldap/tests/gh17704.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
GH-17704 (ldap_search fails when $attributes contains a non-packed array with numerical keys)
3+
--EXTENSIONS--
4+
ldap
5+
--SKIPIF--
6+
<?php
7+
require_once('skipifbindfailure.inc');
8+
?>
9+
--FILE--
10+
<?php
11+
include "connect.inc";
12+
13+
$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
14+
15+
$attributes = ["uid", "cn"];
16+
// force a non-packed array
17+
$attributes["x"] = "x";
18+
unset($attributes["x"]);
19+
20+
var_dump(ldap_search($link, $base, "(o=*)", $attributes));
21+
?>
22+
--EXPECTF--
23+
object(LDAP\Result)#%d (0) {
24+
}

0 commit comments

Comments
 (0)