Skip to content

[HttpFoundation] Deprecate \Stringable support in InputBag #47087

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 1 commit into from

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Jul 27, 2022

Q A
Branch? 6.2
Bug fix? no
New feature? no
Deprecations? yes
Tickets #46957 (comment)
License MIT
Doc PR symfony/symfony-docs#...

As discussed in #46957, it seems there is no valid use case for using \Stringable objects with InputBag.

@chalasr chalasr force-pushed the inputbag-stringable-deprec branch from da8fb96 to b854ba4 Compare July 27, 2022 16:26
@nicolas-grekas
Copy link
Member

Personally I wouldn't merge this PR: this serves no practical purpose to me. I understand the motivation: InputBag represents values that can be found in request payloads, and these can only be strings or array of strings. InputBag in its first merged version allowed only strings|null. Then ppl reported that before InputBag was introduced, we used a ParameterBag, and this one allowed any kind of values. We thus made InputBag a bit more open and allowed all scalars (which Stringable is a kind of). When we did so, we preserved the original motivation for introducing InputBag (properly dealing with array inputs vs non-array ones) without breaking BC too heavily.

To me, this ship has sailed: yes, we could deprecate all non-string values, since none of them are possible values in raw HTTP. Yet, this would plan for a BC break that I don't see the value of.

@fabpot
Copy link
Member

fabpot commented Jul 28, 2022

Then, my recommendation would be to deprecate this class altogether as it's not about HTTP anymore, it's just a bag of things.

@nicolas-grekas
Copy link
Member

Deprecating InputBag would require us to use ParameterBag, which is even less strict. The reason why we introduced InputBag was to behave properly when ppl submit foo[]=123 instead of foo=123 in the query string. This reason still holds true and InputBag handles the situation as we want it to do.

Another idea might be to deprecate the $default arguments, since it's not needed anymore with the ?? operator. But honestly, I don't feel like this is worth it...

To me, #46957 is all that we need on this topic: it fixes a badly removed BC layer.

@chalasr
Copy link
Member Author

chalasr commented Jul 28, 2022

While working on this, I felt this it is not worth the noise it does. I agree with Nicolas we'd probably better not change anything

@nicolas-grekas
Copy link
Member

Let's close then :)

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.

4 participants