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

Skip to content

[HttpKernel] Don't validate partially denormalized object #53107

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? 6.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #53075
License MIT

When one or more required constructor arguments are missing, the object is instantiated with newInstanceWithoutConstructor():

} catch (\TypeError $e) {
if (!isset($context['not_normalizable_value_exceptions'])) {
throw $e;
}
return $reflectionClass->newInstanceWithoutConstructor();
}

Since this means that all properties are empty, validating the entire object is unnecessary. This PR suggests avoiding the call to the validator when violations have already been identified through the PartialDenormalizationException.

@nicolas-grekas
Copy link
Member

Thank you @HypeMC.

@nicolas-grekas nicolas-grekas merged commit eef0d54 into symfony:6.3 Dec 18, 2023
@HypeMC HypeMC deleted the fix-maprequestpayload-returns-full-violationslist branch December 18, 2023 13:55
@xabbuh xabbuh mentioned this pull request Dec 19, 2023
This was referenced Dec 30, 2023
nicolas-grekas added a commit that referenced this pull request Jan 2, 2024
This PR was merged into the 5.4 branch.

Discussion
----------

[Serializer] Fix using deserialization path 5.4

| 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.

Commits
-------

d498de7 [Serializer] Fix using deserialization path
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.

4 participants