xref: /PHP-8.4/ext/ldap/tests/gh16032-1.phpt (revision f4c45ee3)
1--TEST--
2Bug GH-16032: Various NULL pointer dereferencements in ldap_modify_batch()
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
12$modification_missing_attrib_key = [
13    [
14        "modtype" => LDAP_MODIFY_BATCH_ADD,
15        "values"  => ["value1"],
16    ],
17];
18try {
19    var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_missing_attrib_key));
20} catch (Throwable $e) {
21    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
22}
23
24?>
25--EXPECT--
26ValueError: ldap_modify_batch(): Required option "attrib" is missing
27