Skip to content

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented Feb 3, 2017

This PR highlights the cause of the issue experienced in #17753

When the transformation middleware runs, $request->json() is called and the returned parameter bag is replaced with the transformed one, later calls to ->json() presents the modified bag not the original one: https://github.com/laravel/framework/blob/5.4/src/Illuminate/Http/Request.php#L294

For form requests when we initialise it we pass the original content:

$current->cookies->all(), $files, $current->server->all(), $current->getContent()

So when ->json() is called on the form request, it'll read the original content of the request and thus why the transformation won't take effect.

In this PR I explicitly set the json bag of the form request from the json bag of the original request, this way ->json() won't have to look into the content since there's already a bag present.

@taylorotwell taylorotwell merged commit 9a1c5f3 into laravel:5.4 Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants