Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Create new Json ParameterBag Instance when cloning Request #45164

Conversation

kohlerdominik
Copy link
Contributor

@kohlerdominik kohlerdominik commented Dec 2, 2022

When creating a new Request instance by createFrom, all attributes of the request get copied to a new InputBag-instance (Request:444-450)

The only exception is the $json-attribute: there, the object of the old instance ($from) get referenced. This means, if the ParameterBag is modified in the new instance, this change also applies in the old instance. I do not think, that this behavior is intended. For me, it was certainly unexpected.

This PR would fix this issue quite straight forward by simply cloning the ParameterBag instance. If another type of implementation is desired to fix this, please let me know.


This issue was merged already in 9.x in #44671. In #44812 we realized, that this is a breaking change, therefore it was reverted.

I suggest to release this change with the next major, and having a note about the change the upgrade guide.

Applications, that break because of this change are mixing instances of Illuminate\Http\Request with others of Illuminate\Foundation\Http\FormRequest. They should consistenly either use Illuminate\Http\Request (which is a singleton), or pass the same instance of Illuminate\Foundation\Http\FormRequest forward. See detailed explaination with examples here. It's important to point out, that they are not desigend to be mixed. Because of the bug, it was possible to mix them and use parameters from the $json-ParameterBag within each other. It didn't work for other ParameterBags.

@taylorotwell
Copy link
Member

I don't think I'm going to pursue this. It's a breaking change that potentially would affect a lot of applications in subtle ways.

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.

3 participants