Skip to content

Commit f22d717

Browse files
committed
ext/ldap: Add a test with references in list
1 parent ea92ed9 commit f22d717

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
Programming errors (Value/Type errors) for parallel usage of ldap_list(), ldap_read(), and ldap_search() with references
3+
--EXTENSIONS--
4+
ldap
5+
--FILE--
6+
<?php
7+
8+
/* ldap_list(), ldap_read(), and ldap_search() share an underlying C function */
9+
/* We are assuming 3333 is not connectable */
10+
$ldap = ldap_connect('ldap://127.0.0.1:3333');
11+
$valid_dn = "cn=userA,something";
12+
$valid_filter = "";
13+
14+
$ldaps = [$ldap, $ldap];
15+
16+
$str = "string\0with_nul_byte";
17+
$str_ref =& $str;
18+
19+
$list_with_ref_nul_byte = [
20+
$str_ref,
21+
"string2",
22+
];
23+
24+
try {
25+
var_dump(ldap_list($ldaps, $list_with_ref_nul_byte, $valid_filter));
26+
} catch (Throwable $e) {
27+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
28+
}
29+
try {
30+
var_dump(ldap_list($ldaps, $valid_dn, $list_with_ref_nul_byte));
31+
} catch (Throwable $e) {
32+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
33+
}
34+
35+
?>
36+
--EXPECT--
37+
ValueError: ldap_list(): Argument #2 ($base) must not contain null bytes
38+
ValueError: ldap_list(): Argument #3 ($filter) must not contain null bytes

0 commit comments

Comments
 (0)