-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Serializer does not map basic non-string types correctly in XML and CSV #33849
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
Comments
This is a massive problem which makes the Serializer component completely unusable with XML. We are required to handle XML content on our API so that it can integrate with legacy technology. Same problem in API Platform @dunglas |
@mkrauser is this issue still moving? It's holding up the fix in API Platform. Let me know if you don't have time to finish it I'll pick it up in a separate PR. |
@warslett Yes, definitly! |
…es in XML and CSV (mkrauser) This PR was submitted for the 3.4 branch but it was squashed and merged into the 5.2-dev branch instead. Discussion ---------- [Serializer] fix denormalization of basic property-types in XML and CSV | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #33849 | License | MIT | Doc PR | Like I explained in the Issue, the serializer cannot de-serialize non-string basic properties (int, float, bool). This PR add's some logic to cast to the expected types. Similar logic is already present in the [XmlUtils](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Config/Util/XmlUtils.php#L215)-Class of the Config-Component Commits ------- 3824daf [Serializer] fix denormalization of basic property-types in XML and CSV
I still get that issue in the case of a custom normalizer ( My |
Symfony version(s) affected: 3.4, 4.4
Description
In XML and CSV, all values are represented the same way, it is not possible to determine if a value is intended to be a string, int, float or boolean.
If something with non string properties (int, float, bool) is deserialized, an error is thrown:
How to reproduce
I'll submit a PR with a failing test
Possible Solution
The values need to be converted cast to the expected type.
Additional context
Tested with php 7.2
The text was updated successfully, but these errors were encountered: