xref: /PHP-8.4/ext/ldap/tests/gh16132-2.phpt (revision c910e78c)
1--TEST--
2Bug GH-16132: Attempting to free pointer not allocated by ZMM
3--EXTENSIONS--
4ldap
5--FILE--
6<?php
7
8/* ldap_add(_ext)(), ldap_mod_replace(_ext)(), ldap_mod_add(_ext)(), and ldap_mod_del(_ext)() 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
13$dict_key_multi_value_not_list_of_strings2 = [
14    'attribute1' => 'value',
15    'attribute2' => [
16        'value1',
17        new stdClass(),
18    ],
19];
20try {
21    var_dump(ldap_add($ldap, $valid_dn, $dict_key_multi_value_not_list_of_strings2));
22} catch (Throwable $e) {
23    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
24}
25
26?>
27--EXPECT--
28Error: Object of class stdClass could not be converted to string
29