diff --git a/ext/standard/http.c b/ext/standard/http.c index a9e56d4516191..7a4a58755d894 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -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); diff --git a/ext/standard/tests/http/request_parse_body/options_array_references.phpt b/ext/standard/tests/http/request_parse_body/options_array_references.phpt new file mode 100644 index 0000000000000..6c6c0c1576516 --- /dev/null +++ b/ext/standard/tests/http/request_parse_body/options_array_references.phpt @@ -0,0 +1,14 @@ +--TEST-- +request_parse_body: reference in options array +--FILE-- + '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