1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-18400: http_build_query type error is inaccurate

Objects are also accepted still, so the error message is misleading.

Closes GH-18434.
This commit is contained in:
Niels Dossche
2025-04-26 12:49:47 +02:00
parent 4ff41cfb4b
commit 7a2bef02c0
3 changed files with 3 additions and 2 deletions

1
NEWS
View File

@@ -13,6 +13,7 @@ PHP NEWS
- Standard:
. Fixed bug GH-17403 (Potential deadlock when putenv fails). (nielsdos)
. Fixed bug GH-18400 (http_build_query type error is inaccurate). (nielsdos)
24 Apr 2025, PHP 8.4.7

View File

@@ -246,7 +246,7 @@ PHP_FUNCTION(http_build_query)
ZEND_PARSE_PARAMETERS_END();
if (UNEXPECTED(Z_TYPE_P(formdata) == IS_OBJECT && (Z_OBJCE_P(formdata)->ce_flags & ZEND_ACC_ENUM))) {
zend_argument_type_error(1, "must be of type array, %s given", zend_zval_value_name(formdata));
zend_argument_type_error(1, "must not be an enum, %s given", zend_zval_value_name(formdata));
RETURN_THROWS();
}

View File

@@ -33,4 +33,4 @@ try {
--EXPECT--
e1=hello+world%21&e2=42
ValueError: Unbacked enum E3 cannot be converted to a string
TypeError: http_build_query(): Argument #1 ($data) must be of type array, E1 given
TypeError: http_build_query(): Argument #1 ($data) must not be an enum, E1 given