Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Serializer] FixObjectNormalizer gives warnings on normalizing with public static property#58255
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedSep 13, 2024
Hey! I see that this is your first PR. That is great! Welcome! Symfony has acontribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
carsonbot commentedSep 13, 2024
Hey! Thanks for your PR. You are targeting branch "7.1" but it seems your PR description refers to branch ">= 7.1.2". Cheers! Carsonbot |
Does this also affect 6.4? |
src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
@xabbuh It also affects 6.4. I have tested it with v6.4.11. |
@alexandre-daubois try-catch is removed. However, I have left |
You may rebase your PR onto 6.4 and change the target branch of the PR. This way, the fix is available on all (still supported) affected branches |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ObjectNormalizer gives warnings on normalizing with static propertysrc/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
ObjectNormalizer gives warnings on normalizing with static propertyObjectNormalizer gives warnings on normalizing with public static propertyUh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
…h public static property
Thank you@alaugks. |
f5a5104 intosymfony:6.4Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
The error message has been occurring since version 6.4.11/7.1.2. If the condition is changed to version >=7.1.2, the error message no longer occurs.
The error is thrown with the following ObjectNormalizer configuration:
(\is_object($classOrObject) && $this->propertyAccessor->isReadable($classOrObject, $attribute))is true and therefore the entire condition is true.I moved the condition into a method to improve readability and reduce complexity.
All serializer tests are successful.
Condition
For better readability here with breaks.
7.1.1
https://github.com/symfony/symfony/blob/v7.1.1/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php#L180
>=7.2.2
https://github.com/symfony/symfony/blob/v7.1.2/src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php#L180
Fixed condition