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
[Serializer] Deserialize union type of BackedEnum does not work #47797
Labels
Comments
Can you send a pull request with that change (and ideally a test covering it) ? |
Yes |
What can we do to solve this problem? |
I tried another approach to solve that issue: #51475 |
fabpot
added a commit
that referenced
this issue
Aug 26, 2023
This PR was merged into the 6.3 branch. Discussion ---------- [Serializer] Fix union of enum denormalization | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #47797 | License | MIT | Doc PR | Try other types when a `InvalidArgumentException` occurs for a union type. Commits ------- 11378ef [Serializer] Fix union of enum denormalization
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
5.4.12 and newer
6.x
Description
Hello,
It becomes impossible to deserialize a union type that contains a
BackedEnum
, becauseInvalidArgumentException
is not caught.It seems that a bug is introduced with the commit symfony/serializer@3fc9afe.
How to reproduce
composer.json
index.php
Deserialize A does not work
Expected :
Result :
Possible Solution
In method
denormalize
onSymfony\Component\Serializer\NormalizerBackedEnumNormalizer
changeInvalidArgumentException
byNotNormalizableValueException
From:
To:
Additional Context
No response
The text was updated successfully, but these errors were encountered: