You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#35851 introduced a BC break with json columns. Previously when using @var mixed and @ORM\Column(type="json") property info returned null for type so serializer accepted any value for this, but currently it always returns Type as builtin array and it doesn't accept anymore mixed values.
How to reproduce
will write if needed
Possible Solution
Return null for json type column, while leaving json_array column intact.
Additional context
The text was updated successfully, but these errors were encountered:
This is normal since now the json type is supported. json is the new name of json_array.
However I agree with you that this type can be used with mixed data, ie it doesn't have to be array. I reported it in another PR (see #35794 (comment)). But it has always been like this (on the json_array type), this is why I applied the same treatment for json. Both have to be consistent I guess. IMO, we should return null for both since we can't guess but that would break compatibility too.
I disagree. In json_array doctrine was converting null or empty value to array, but json type doesn't do that. In my opinion property info is too strict to always set this as array while doctrine can store any value for json
… for "json" type (fancyweb)
This PR was merged into the 3.4 branch.
Discussion
----------
[DoctrineBridge][DoctrineExtractor] Fix wrong guessed type for "json" type
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #35968
| License | MIT
| Doc PR | -
After checking the code, it appears that `json` have a different behavior than `json_array`.
> In json_array doctrine was converting null or empty value to array, but json type doesn't do that
@norkunas is right about this. Consequently, we cannot safely guess a built in type for the `json` Doctrine type.
Commits
-------
f9f5f8d [DoctrineBridge][DoctrineExtractor] Fix wrong guessed type for "json" type
Symfony version(s) affected: >=4.4
Description
#35851 introduced a BC break with json columns. Previously when using
@var mixed
and@ORM\Column(type="json")
property info returnednull
for type so serializer accepted any value for this, but currently it always returnsType
as builtin array and it doesn't accept anymore mixed values.How to reproduce
will write if needed
Possible Solution
Return
null
for json type column, while leavingjson_array
column intact.Additional context
The text was updated successfully, but these errors were encountered: