-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Symfony version(s) affected
7.4.0
Description
When sending an HTTP request with method DELETE and content type application/x-www-form-urlencoded to one of our endpoints (payload example: id=1234), the request body is not available in the controller.
This also occurs with other HTTP methods.
It appears that the body is parsed twice during the runtime initialization process, first parse reads the data and clears the input stream, second parse returns empty arrays then.
First parse (body still present)
SymfonyRuntime::getArgument()- calls
Request::createFromGlobals() - calls
request_parse_body
Second parse (body cleared)
SymfonyRuntime::getRunner()- calls
Request::createFromGlobals() - calls
request_parse_bodyagain
request_parse_body cannot be called twice, therefore the body is empty afterwards.
The commit that introduced request_parse_body:
symfony/http-foundation@f9b8417
SymfonyRuntime::getArgument() & SymfonyRuntime::getRunner()
https://github.com/symfony/runtime/blob/7.4/SymfonyRuntime.php#L220
https://github.com/symfony/runtime/blob/7.4/SymfonyRuntime.php#L175
How to reproduce
Send http request including DELETE method, content type application/x-www-form-urlencoded and form data to an endpoint.
Possible Solution
No response
Additional Context
PHP 8.4