Skip to content

Commit f58a3c3

Browse files
committed
Fix references in request_parse_body() options array
Otherwise we get funny messages like "Invalid string value in $options argument". Closes GH-14977.
1 parent c4f1c5c commit f58a3c3

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

NEWS

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

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

2930
- Windows:
3031
. Update the icon of the Windows executables, e.g. php.exe. (Ayesh,

ext/standard/http.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ static zend_result cache_request_parse_body_option(HashTable *options, zval *opt
244244
{
245245
if (option) {
246246
zend_long result;
247+
ZVAL_DEREF(option);
247248
if (Z_TYPE_P(option) == IS_STRING) {
248249
zend_string *errstr;
249250
result = zend_ini_parse_quantity(Z_STR_P(option), &errstr);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
request_parse_body: reference in options array
3+
--FILE--
4+
<?php
5+
$options = ['post_max_size' => '128M'];
6+
foreach ($options as $k => &$v) {}
7+
try {
8+
request_parse_body($options);
9+
} catch (Throwable $e) {
10+
echo $e->getMessage(), "\n";
11+
}
12+
?>
13+
--EXPECT--
14+
Request does not provide a content type

0 commit comments

Comments
 (0)