Commit 545da11
committed
bug #49537 [Serializer] Unexpected value should throw UnexpectedValueException (ThomasTr)
This PR was merged into the 5.4 branch.
Discussion
----------
[Serializer] Unexpected value should throw UnexpectedValueException
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | See my recently started discussion here: symfony/symfony#49535
| License | MIT
| Doc PR | NA
If a DateTime field to be serialised has a data type other than string (e.g. a serialised DateTime as array), a TypeException is thrown. This exception cannot be caught by a try/catch around the serializer.
This fix throws a NotNormalizableValueException that appears cleanly at the corresponding field.
This is my first pull request, please be kind to me :)
Commits
-------
af34c52f80 [Serializer] Unexpected value should throw UnexpectedValueExceptionFile tree
3 files changed
+31
-22
lines changed- Normalizer
- Tests
- Normalizer
3 files changed
+31
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
| 94 | + | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
100 | 101 | | |
101 | | - | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
104 | 105 | | |
105 | | - | |
| 106 | + | |
106 | 107 | | |
107 | | - | |
108 | | - | |
| 108 | + | |
| 109 | + | |
109 | 110 | | |
110 | | - | |
| 111 | + | |
111 | 112 | | |
112 | | - | |
113 | | - | |
| 113 | + | |
| 114 | + | |
114 | 115 | | |
115 | | - | |
116 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
117 | 119 | | |
118 | | - | |
119 | 120 | | |
120 | | - | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
246 | 253 | | |
247 | 254 | | |
248 | 255 | | |
249 | | - | |
| 256 | + | |
250 | 257 | | |
251 | 258 | | |
252 | 259 | | |
253 | 260 | | |
254 | 261 | | |
255 | 262 | | |
256 | | - | |
| 263 | + | |
257 | 264 | | |
258 | 265 | | |
259 | 266 | | |
260 | 267 | | |
261 | 268 | | |
262 | 269 | | |
263 | | - | |
| 270 | + | |
264 | 271 | | |
265 | 272 | | |
266 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
943 | 943 | | |
944 | 944 | | |
945 | 945 | | |
946 | | - | |
| 946 | + | |
947 | 947 | | |
948 | 948 | | |
949 | 949 | | |
| |||
952 | 952 | | |
953 | 953 | | |
954 | 954 | | |
955 | | - | |
| 955 | + | |
956 | 956 | | |
957 | 957 | | |
958 | 958 | | |
| |||
0 commit comments