Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpFoundation] Allow null in InputBag@set #37326

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

Closed
wants to merge 3 commits into from

Conversation

taylorotwell
Copy link
Contributor

@taylorotwell taylorotwell commented Jun 17, 2020

This allows null to be passed to InputBag's set method.

Q A
Branch? master
Bug fix? no
New feature? yes?
Deprecations? no
License MIT

Previously, null was an allowed value to the InputBag's set method. At some point this was deprecated. It would be very nice for us to be able to set this to null. For example, this ability drives a very popular feature of Laravel where we ship a middleware that converts all empty strings to null on incoming requests.

Note that the get method already specifically allows null and null is a valid decoded JSON value.

This allows `null` to be passed to InputBag's `set` method.
@taylorotwell taylorotwell changed the title Allow null in InputBag@set [HttpFoundation] Allow null in InputBag@set Jun 17, 2020
@yceruto yceruto added this to the 5.1 milestone Jun 17, 2020
@ro0NL
Copy link
Contributor

ro0NL commented Jun 17, 2020

see also #37100, we discussed it quite recently.

Previously, null was an allowed value to the InputBag's set method.

Previously it was an instance of ParameterBag.

i still think this is legit, as it allows for using decoded JSON payloads :)

im not sure about hiding empty strings this way, but that's a user concern i guess.

@taylorotwell
Copy link
Contributor Author

@ro0NL Yes, exactly. Laravel users greatly enjoy this feature.

@ro0NL
Copy link
Contributor

ro0NL commented Jun 17, 2020

I can imagine. Symfony's Form component more or less does the same, on a different layer.

@taylorotwell
Copy link
Contributor Author

I have updated the deprecation message.

@taylorotwell
Copy link
Contributor Author

Should I retarget this to 5.1 branch on this PR?

@yceruto yceruto changed the base branch from master to 5.1 June 17, 2020 19:42
@yceruto yceruto changed the base branch from 5.1 to master June 17, 2020 19:43
@yceruto
Copy link
Member

yceruto commented Jun 17, 2020

Yes, you should retarget your patch branch to 5.1

@taylorotwell taylorotwell changed the base branch from master to 5.1 June 17, 2020 19:44
@taylorotwell taylorotwell changed the base branch from 5.1 to master June 17, 2020 19:45
@taylorotwell
Copy link
Contributor Author

taylorotwell commented Jun 17, 2020

Opened against 5.1 here: #37327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants