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

Skip to content

[DependencyInjection] Fix binding parameters with default empty values #57186

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

Conversation

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented May 26, 2024

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #56875
License MIT

Caused by #54791 and #52917 (sort of). The main problem is that once the default value of null was added, the binding didn't resolve properly. The serializer.normalizer.property, and possibly others, have the same problem.

@ruudk
Copy link
Contributor

ruudk commented May 31, 2024

I see this bug fix did not make it to the 7.2.0 release 😢 Can it be merged so that it can ship in 7.2.1?

}
if (\array_key_exists($parameter->name, $arguments) && '' !== $arguments[$parameter->name]) {

if (\array_key_exists($key, $arguments) && !\in_array($arguments[$key], ['', null, []], true)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this makes sense: the empty string is a special case needed when loading from XML, but the others can only be defined by explicit definition.
It's also suspicious to me to change the DI component for an issue with the serializer one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolas-grekas Yeah, I was way off with this solution, see #57273.

@HypeMC HypeMC closed this May 31, 2024
@HypeMC HypeMC deleted the fix-binding-parameters-with-default-empty-values branch May 31, 2024 15:44
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