Skip to content

Conversation

@yoeunes
Copy link
Contributor

@yoeunes yoeunes commented Nov 5, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Issues Fixes #62313
License MIT

This PR fixes a bug in BackedEnumNormalizer that occurs when using collect_denormalization_errors and allow_invalid_values at the same time.

When allow_invalid_values was set, the normalizer would return null for invalid data (like null) before NotNormalizableValueException could be thrown.

This caused the denormalization to fail with a fatal TypeError (e.g., Typed property ... must not be null) instead of populating a PartialDenormalizationException with the expected type errors.

This fix ensures that NotNormalizableValueException is still thrown when collect_denormalization_errors is active (not_normalizable_value_exceptions context key is set), allowing the Serializer to catch it and report the error correctly.

@nicolas-grekas
Copy link
Member

Thank you @yoeunes.

@nicolas-grekas nicolas-grekas merged commit 2dc11e4 into symfony:6.4 Nov 12, 2025
11 checks passed
This was referenced Nov 13, 2025
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.

3 participants