Skip to content

Commit a2ac800

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-18015: Error messages for ldap_mod_replace are confusing
2 parents 6b6fde9 + 6717947 commit a2ac800

3 files changed

+5
-5
lines changed

ext/ldap/ldap.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -2316,12 +2316,12 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
23162316
SEPARATE_ARRAY(attribute_values);
23172317
uint32_t num_values = zend_hash_num_elements(Z_ARRVAL_P(attribute_values));
23182318
if (num_values == 0) {
2319-
zend_argument_value_error(3, "list of attribute values must not be empty");
2319+
zend_argument_value_error(3, "attribute \"%s\" must be a non-empty list of attribute values", ZSTR_VAL(attribute));
23202320
RETVAL_FALSE;
23212321
goto cleanup;
23222322
}
23232323
if (!php_ldap_is_numerically_indexed_array(Z_ARRVAL_P(attribute_values))) {
2324-
zend_argument_value_error(3, "must be an array of attribute values with numeric keys");
2324+
zend_argument_value_error(3, "attribute \"%s\" must be an array of attribute values with numeric keys", ZSTR_VAL(attribute));
23252325
RETVAL_FALSE;
23262326
goto cleanup;
23272327
}

ext/ldap/tests/ldap_add_modify_delete_programming_errors.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ ValueError: ldap_add(): Argument #3 ($entry) must be an associative array of att
137137
ValueError: ldap_add(): Argument #3 ($entry) key must not be empty
138138
ValueError: ldap_add(): Argument #3 ($entry) key must not contain any null bytes
139139
Error: Object of class stdClass could not be converted to string
140-
ValueError: ldap_add(): Argument #3 ($entry) list of attribute values must not be empty
141-
ValueError: ldap_add(): Argument #3 ($entry) must be an array of attribute values with numeric keys
140+
ValueError: ldap_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values
141+
ValueError: ldap_add(): Argument #3 ($entry) attribute "attribute2" must be an array of attribute values with numeric keys
142142
TypeError: LDAP value must be of type string|int|bool, array given
143143
Error: Object of class stdClass could not be converted to string

ext/ldap/tests/ldap_add_modify_delete_references_programming_errors.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ try {
7676
?>
7777
--EXPECT--
7878
Error: Object of class stdClass could not be converted to string
79-
ValueError: ldap_add(): Argument #3 ($entry) list of attribute values must not be empty
79+
ValueError: ldap_add(): Argument #3 ($entry) attribute "attribute2" must be a non-empty list of attribute values
8080
TypeError: LDAP value must be of type string|int|bool, array given
8181
TypeError: LDAP value must be of type string|int|bool, stdClass given

0 commit comments

Comments
 (0)