-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Fix access to private properties/getters when using the @Ignore
annotation
#52680
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
mtarld
commented
Nov 22, 2023
Q | A |
---|---|
Branch? | 5.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Issues | Fix #52673 #49710 |
License | MIT |
src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
Outdated
Show resolved
Hide resolved
@Ignore
annotation
src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
Outdated
Show resolved
Hide resolved
@mtarld am I misunderstanding the documentation though? It says
Which to mean means even private and protected. While I think the fix here makes sense, it doesn't align with the documentation. Should the documentation also be updated to say only publicly accessible attributes are included? Or is that what |
Private or protected properties are included if they have getters to access them publicly. |
That's what I thought. Then the documentation should be updated to specify that instead of all attributes correct? |
Indeed, we could go with something like: "All accessible attributes are included by default when serializing objects.". WDYT? Up for a PR? |
Yes. I’m out of the office until Tuesday, but when I get back I’m happy to submit a PR. |
|
Failures should be fixed in #52713 |
Thank you @mtarld. |
…efault (nesl247) This PR was submitted for the 6.4 branch but it was merged into the 5.4 branch instead. Discussion ---------- fix: serializer includes only accessible attributes by default Updates documentation based upon the discussion here: symfony/symfony#52680 Commits ------- 674ff7d fix: serializer includes only accessible attributes by default
This PR was merged into the 5.4 branch. Discussion ---------- [Serializer] Revert allowed attributes fix | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT Revert #52767 and #52680, as it does not cover some specific use cases, and can't be fixed in time. I'll attempt to fix it in a better way, taking more time. Commits ------- 1dc20a8 [Serializer] Revert allowed attributes fix
This PR was merged into the 5.4 branch. Discussion ---------- [Serializer] Fix unexpected allowed attributes | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #52673 #49710 | License | MIT A more accurate approach than #52680 Commits ------- 900d034 [Serializer] Fix unexpected allowed attributes