Skip to content

[Serializer] Fix code skipped by premature return #60025

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

Merged

Conversation

HypeMC
Copy link
Member

@HypeMC HypeMC commented Mar 23, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

The problem with the current code is the early return:

if (!$container->hasDefinition('serializer.normalizer.object')) {
return;
}

Some code after the return is not related to the object normalizer, and should therefor not be skipped:

$container->getDefinition('serializer.normalizer.property')->setArgument(5, $defaultContext);
}

This PR replaces the early return by wrapping the code related to the object normalizer inside the if block to prevent any future mistakes.

Probably easier to review with whitespace changes hidden.

@nicolas-grekas
Copy link
Member

Thank you @HypeMC.

@nicolas-grekas nicolas-grekas merged commit 8b43964 into symfony:6.4 Mar 24, 2025
10 of 11 checks passed
@HypeMC HypeMC deleted the fix-code-skipped-by-premature-return branch March 24, 2025 09:01
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