-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Fix object normalizer when properties has the same name as their accessor #54148
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
Conversation
Fabbot doesn't seems happy, but it complains about things which are not in my changes... Should I update it too ? |
You can ignore it |
src/Symfony/Component/Serializer/Tests/Fixtures/SamePropertyAsMethodDummy.php
Outdated
Show resolved
Hide resolved
...ny/Component/Serializer/Tests/Fixtures/SamePropertyAsMethodWithMethodSerializedNameDummy.php
Outdated
Show resolved
Hide resolved
…as their accessor
70b197e
to
8575199
Compare
Thank you @NeilPeyssard. |
Hi @fabpot @nicolas-grekas @NeilPeyssard I think this PR could make BC-Break. In my case in my project (with SF 6.4), I have a lot base-code where a property have the same name as accessor-method. For example:
returns before returns after This situation means that if "keys" are sent via the API in the original version, it now has to be fixed, which is a difficult work. At the moment, only way is to add conflict in In my opinion, you have a right - this was bug but this should be fixed in deprecation-way with some warnings. WDYT ? |
… has the same name as their accessor" - it was a BC Break (NeilPeyssard) This PR was merged into the 5.4 branch. Discussion ---------- [Serializer] Revert "Fix object normalizer when properties has the same name as their accessor" - it was a BC Break | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #54488 | License | MIT Revert changes from this PR #54148 (BC Break). Commits ------- f6b4c65 [Serializer] Revert #54488 to fix BC Break
Hello,
This PR fix a bug in object normalization when properties has the same name as their accessor. The current behavior mess up class metadata between properties and methods so the keys in the normalized format does not match the object properties, and metadata are not correctly applied (
SerializedName
in our exemple).This bug also affects versions 6.4 and 7+, but I'm not sure if we can merge this PR in these branches without refactoring. Let me know if another PR should be open for version 6.4 and 7.