1--TEST--
2Programming errors (Value/Type errors) for parallel usage of ldap_list(), ldap_read(), and ldap_search() with references
3--EXTENSIONS--
4ldap
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
18$list_with_ref_nul_byte = [
19    &$str,
20    "string2",
21];
22
23try {
24    var_dump(ldap_list($ldaps, $list_with_ref_nul_byte, $valid_filter));
25} catch (Throwable $e) {
26    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
27}
28try {
29    var_dump(ldap_list($ldaps, $valid_dn, $list_with_ref_nul_byte));
30} catch (Throwable $e) {
31    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
32}
33
34?>
35--EXPECT--
36ValueError: ldap_list(): Argument #2 ($base) must not contain null bytes
37ValueError: ldap_list(): Argument #3 ($filter) must not contain null bytes
38