ext/ldap: Promote warning to ValueError if array is not a dict

This commit is contained in:
Gina Peter Banyard 2024-10-01 00:20:39 +01:00
parent 127968b1e4
commit d34d015078
3 changed files with 4 additions and 7 deletions

View file

@ -2235,7 +2235,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
unsigned int attribute_index = 0;
ZEND_HASH_FOREACH_STR_KEY_VAL(attributes_ht, attribute, attribute_values) {
if (attribute == NULL) {
php_error_docref(NULL, E_WARNING, "Unknown attribute in the data");
zend_argument_value_error(3, "must be an associative array of attribute => values");
RETVAL_FALSE;
goto cleanup;
}

View file

@ -25,6 +25,5 @@ try {
}
?>
--EXPECTF--
Warning: ldap_add(): Unknown attribute in the data in %s on line %d
bool(false)
--EXPECT--
ValueError: ldap_add(): Argument #3 ($entry) must be an associative array of attribute => values

View file

@ -133,9 +133,7 @@ try {
?>
--EXPECTF--
ValueError: ldap_add(): Argument #3 ($entry) must not be empty
Warning: ldap_add(): Unknown attribute in the data in %s on line %d
bool(false)
ValueError: ldap_add(): Argument #3 ($entry) must be an associative array of attribute => values
Warning: ldap_add(): Add: Can't contact LDAP server in %s on line %d
bool(false)