xref: /php-src/ext/ldap/tests/gh16101.phpt (revision 19bba837)
1--TEST--
2Bug GH-16101: Segfault in ldap_list(), ldap_read(), and ldap_search() when LDAPs array is not a list
3--EXTENSIONS--
4ldap
5--FILE--
6<?php
7
8/* We are assuming 3333 is not connectable */
9$ldap = ldap_connect('ldap://127.0.0.1:3333');
10$valid_dn = "cn=userA,something";
11$valid_filter = "";
12
13$ldaps_dict = [
14    "hello"  => $ldap,
15    "world"  => $ldap,
16];
17try {
18    var_dump(ldap_list($ldaps_dict, $valid_dn, $valid_filter));
19} catch (Throwable $e) {
20    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
21}
22
23?>
24--EXPECT--
25ValueError: ldap_list(): Argument #1 ($ldap) must be a list
26