xref: /php-src/ext/ldap/tests/gh16132-1.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_value_not_string = [
14    'attribute1' => new stdClass(),
15    'attribute2' => [
16        'value1',
17        'value2',
18    ],
19];
20try {
21    var_dump(ldap_add($ldap, $valid_dn, $dict_key_value_not_string));
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