Skip to content

Commit

Permalink
Fix references in request_parse_body() options array
Browse files Browse the repository at this point in the history
Otherwise we get funny messages like
"Invalid string value in $options argument".

Closes phpGH-14977.
  • Loading branch information
nielsdos committed Jul 16, 2024
1 parent c4f1c5c commit f58a3c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PHP NEWS

- Standard:
. Change highlight_string() and print_r() return type to string|true. (Ayesh)
. Fix references in request_parse_body() options array. (nielsdos)

- Windows:
. Update the icon of the Windows executables, e.g. php.exe. (Ayesh,
Expand Down
1 change: 1 addition & 0 deletions ext/standard/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ static zend_result cache_request_parse_body_option(HashTable *options, zval *opt
{
if (option) {
zend_long result;
ZVAL_DEREF(option);
if (Z_TYPE_P(option) == IS_STRING) {
zend_string *errstr;
result = zend_ini_parse_quantity(Z_STR_P(option), &errstr);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
request_parse_body: reference in options array
--FILE--
<?php
$options = ['post_max_size' => '128M'];
foreach ($options as $k => &$v) {}
try {
request_parse_body($options);
} catch (Throwable $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Request does not provide a content type

0 comments on commit f58a3c3

Please sign in to comment.