From 6717947ffe20ac3cd959903545ba5ef5ad1e1e79 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:00:43 +0100 Subject: [PATCH] Fix GH-18015: Error messages for ldap_mod_replace are confusing Closes GH-18053. --- NEWS | 4 ++++ ext/ldap/ldap.c | 2 +- ext/ldap/tests/ldap_add_error.phpt | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index cbf9dd7bd79..805363ed248 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,10 @@ PHP NEWS . Fixed bug GH-17984 (calls with arguments as array with references). (David Carlier) +- LDAP: + . Fixed bug GH-18015 (Error messages for ldap_mod_replace are confusing). + (nielsdos) + - Mbstring: . Fixed bug GH-17989 (mb_output_handler crash with unset http_output_conv_mimetypes). (nielsdos) diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 67b01c0ec44..20245ed5696 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -2278,7 +2278,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext) ldap_mods[i]->mod_bvalues[0]->bv_len = Z_STRLEN_P(value); } else { if (!php_ldap_is_numerically_indexed_array(Z_ARRVAL_P(value))) { - zend_argument_value_error(3, "must be an array with numeric keys"); + zend_argument_value_error(3, "attribute \"%s\" must be an array with numeric keys", ZSTR_VAL(attribute)); RETVAL_FALSE; num_berval[i] = 0; num_attribs = i + 1; diff --git a/ext/ldap/tests/ldap_add_error.phpt b/ext/ldap/tests/ldap_add_error.phpt index 5036b3091e8..209a7fb165d 100644 --- a/ext/ldap/tests/ldap_add_error.phpt +++ b/ext/ldap/tests/ldap_add_error.phpt @@ -104,7 +104,7 @@ Warning: ldap_add(): Add: Already exists in %s on line %d bool(false) string(14) "Already exists" int(68) -ldap_add(): Argument #3 ($entry) must be an array with numeric keys +ldap_add(): Argument #3 ($entry) attribute "objectClass" must be an array with numeric keys Warning: ldap_add(): Add: Undefined attribute type in %s on line %d bool(false)