Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Fix using deserialization path 5.4 #53108

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

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Dec 17, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

I've noticed this while working on #53107.

Sometimes, the path provided to the NotNormalizableValueException is incorrect.

@HypeMC HypeMC requested a review from dunglas as a code owner December 17, 2023 18:33
@carsonbot carsonbot added this to the 5.4 milestone Dec 17, 2023
@HypeMC HypeMC force-pushed the serializer-fix-using-deserialization-path-5.4 branch from 809932d to 3c07a87 Compare December 17, 2023 20:48
@nicolas-grekas
Copy link
Member

Any opinion on this @dunglas @lyrixx @mtarld or anyone else?

Copy link
Contributor

@mtarld mtarld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, before that PR, paths related to constructor weren't taken into account. And it does look good to me to be more precise in that case

@HypeMC HypeMC force-pushed the serializer-fix-using-deserialization-path-5.4 branch 2 times, most recently from 9194fa4 to b7d9b29 Compare December 29, 2023 15:51
@nicolas-grekas
Copy link
Member

Actually, before that PR, paths related to constructor weren't taken into account. And it does look good to me to be more precise in that case

Should we interpret this as an improvement then? For 7.1?

@HypeMC
Copy link
Contributor Author

HypeMC commented Dec 29, 2023

Actually, before that PR, paths related to constructor weren't taken into account. And it does look good to me to be more precise in that case

Should we interpret this as an improvement then? For 7.1?

@nicolas-grekas To me, this seems like a bug. As far as I can tell, the $attributeContext variable was introduced in #39399 for version 5.3, whereas support for collecting type errors was introduced in version 5.4 with #42502. It appears that the wrong variable might have been used by accident 🤷

@HypeMC
Copy link
Contributor Author

HypeMC commented Dec 29, 2023

There's also the fact that the messages actually have the correct paths in them:

            [
...
-                'path' => null,
+                'path' => 'string',
                 'message' => 'Failed to create object because the class misses the "string" property.',
            ],

@mtarld
Copy link
Contributor

mtarld commented Dec 30, 2023

I agree with @HypeMC, it can be considered as a bugfix in my opinion

@HypeMC HypeMC force-pushed the serializer-fix-using-deserialization-path-5.4 branch from b7d9b29 to d498de7 Compare December 31, 2023 05:05
@nicolas-grekas
Copy link
Member

Thank you @HypeMC.

@nicolas-grekas nicolas-grekas merged commit d70b158 into symfony:5.4 Jan 2, 2024
@HypeMC HypeMC deleted the serializer-fix-using-deserialization-path-5.4 branch January 2, 2024 09:01
This was referenced Jan 30, 2024
@fabpot fabpot mentioned this pull request Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants