xref: /php-src/ext/ldap/tests/gh16032-2.phpt (revision cf043af8)
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_modtype_key = [
13    [
14        "attrib"  => "attrib1",
15        "values"  => ["value1"],
16    ],
17];
18try {
19    var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_missing_modtype_key));
20} catch (Throwable $e) {
21    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
22}
23
24?>
25--EXPECT--
26ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) a modification entry must contain the "modtype" option
27