Skip to content

Commit

Permalink
ext/standard: Fix GH-9316
Browse files Browse the repository at this point in the history
http_build_query() default null argument for  is implicitly coerced to string

Closes GH-9316
  • Loading branch information
Girgias committed Nov 22, 2023
1 parent c524dc6 commit 37f67a9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 3 additions & 1 deletion NEWS
Expand Up @@ -2,7 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.3.1


- Standard
. Fixed GH-9316 (http_build_query() default null argument for $arg_separator
is implicitly coerced to string). (Girgias)

23 Nov 2023, PHP 8.3.0

Expand Down
2 changes: 1 addition & 1 deletion ext/standard/http.c
Expand Up @@ -226,7 +226,7 @@ PHP_FUNCTION(http_build_query)
Z_PARAM_ARRAY_OR_OBJECT(formdata)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(prefix, prefix_len)
Z_PARAM_STR(arg_sep)
Z_PARAM_STR_OR_NULL(arg_sep)
Z_PARAM_LONG(enc_type)
ZEND_PARSE_PARAMETERS_END();

Expand Down
17 changes: 17 additions & 0 deletions ext/standard/tests/http/http_build_query/gh12745.phpt
@@ -0,0 +1,17 @@
--TEST--
Bug GH-9316 (http_build_query() default null argument for $arg_separator is implicitly coerced to string)
--FILE--
<?php

$data = [
'hello' => 'world',
'foo' => 'bar',
];

var_dump(http_build_query(
$data,
encoding_type: PHP_QUERY_RFC3986
));
?>
--EXPECT--
string(19) "hello=world&foo=bar"

0 comments on commit 37f67a9

Please sign in to comment.