1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/ldap/tests/gh16032-1.phpt
Gina Peter Banyard f4c45ee376 ext/ldap: Fix GH-16032 (Various NULL pointer dereferencements in ldap_modify_batch())
We check that the "attrib" and "modtype" keys are present in each array.
If not we throw a ValueError, in line with what other validation failure cases do.

Closes GH-16057
2024-09-25 23:23:56 +01:00

27 lines
633 B
PHP

--TEST--
Bug GH-16032: Various NULL pointer dereferencements in ldap_modify_batch()
--EXTENSIONS--
ldap
--FILE--
<?php
/* We are assuming 3333 is not connectable */
$ldap = ldap_connect('ldap://127.0.0.1:3333');
$valid_dn = "cn=userA,something";
$modification_missing_attrib_key = [
[
"modtype" => LDAP_MODIFY_BATCH_ADD,
"values" => ["value1"],
],
];
try {
var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_missing_attrib_key));
} catch (Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
ValueError: ldap_modify_batch(): Required option "attrib" is missing