Commit 2dc11e4
committed
bug #62321 [Serializer] Fix BackedEnumNormalizer behavior with partial denormalization (yoeunes)
This PR was merged into the 6.4 branch.
Discussion
----------
[Serializer] Fix BackedEnumNormalizer behavior with partial denormalization
| 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.
Commits
-------
752933f [Serializer] Fix BackedEnumNormalizer behavior with partial denormalizationFile tree
3 files changed
+83
-11
lines changed- src/Symfony/Component/Serializer
- Normalizer
- Tests
- Normalizer
3 files changed
+83
-11
lines changedLines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 60 | + | |
64 | 61 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 62 | + | |
| 63 | + | |
68 | 64 | | |
69 | 65 | | |
70 | | - | |
71 | 66 | | |
72 | | - | |
73 | 67 | | |
74 | 68 | | |
75 | 69 | | |
76 | 70 | | |
77 | 71 | | |
78 | | - | |
| 72 | + | |
79 | 73 | | |
80 | 74 | | |
81 | 75 | | |
82 | 76 | | |
83 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
129 | 155 | | |
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
1794 | 1795 | | |
1795 | 1796 | | |
1796 | 1797 | | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
1797 | 1830 | | |
1798 | 1831 | | |
1799 | 1832 | | |
| |||
1969 | 2002 | | |
1970 | 2003 | | |
1971 | 2004 | | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
0 commit comments