Skip to content

Commit 7a2bef0

Browse files
committed
Fix GH-18400: http_build_query type error is inaccurate
Objects are also accepted still, so the error message is misleading. Closes GH-18434.
1 parent 4ff41cf commit 7a2bef0

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PHP NEWS
1313

1414
- Standard:
1515
. Fixed bug GH-17403 (Potential deadlock when putenv fails). (nielsdos)
16+
. Fixed bug GH-18400 (http_build_query type error is inaccurate). (nielsdos)
1617

1718
24 Apr 2025, PHP 8.4.7
1819

ext/standard/http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ PHP_FUNCTION(http_build_query)
246246
ZEND_PARSE_PARAMETERS_END();
247247

248248
if (UNEXPECTED(Z_TYPE_P(formdata) == IS_OBJECT && (Z_OBJCE_P(formdata)->ce_flags & ZEND_ACC_ENUM))) {
249-
zend_argument_type_error(1, "must be of type array, %s given", zend_zval_value_name(formdata));
249+
zend_argument_type_error(1, "must not be an enum, %s given", zend_zval_value_name(formdata));
250250
RETURN_THROWS();
251251
}
252252

ext/standard/tests/http/gh15650.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ try {
3333
--EXPECT--
3434
e1=hello+world%21&e2=42
3535
ValueError: Unbacked enum E3 cannot be converted to a string
36-
TypeError: http_build_query(): Argument #1 ($data) must be of type array, E1 given
36+
TypeError: http_build_query(): Argument #1 ($data) must not be an enum, E1 given

0 commit comments

Comments
 (0)