FriendsOfSymfony / FOSRestBundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony
http://symfony.com/doc/master/bundles/FOSRestBundle/index.html
MIT License
2.79k stars 707 forks source link

Use InputBag for Request::$request property when able #2334

Closed mbabker closed 2 years ago

mbabker commented 2 years ago

The BodyListener attempts to decode a request and replaces the parameter bag with the decoded data. When introduced in Symfony 5.1, depending on the initialization path, the $request->request property could be either a ParameterBag or an InputBag, but in 5.3 the Request class was standardized and it always initializes an InputBag. This bundle should use an InputBag when the class is available when overwriting Request::$request.

Note, the current way of overriding the property could result in folks missing the deprecations the InputBag was introduced with regarding accessing array values from the request data, so ensuring the right object is in use could be important to not blindsiding folks with that one.