-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Fix extra attributes when no group specified #24816
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
Merged
fabpot
merged 1 commit into
symfony:3.3
from
ogizanagi:fix/serializer_extra_attributes_no_groups
Nov 5, 2017
Merged
[Serializer] Fix extra attributes when no group specified #24816
fabpot
merged 1 commit into
symfony:3.3
from
ogizanagi:fix/serializer_extra_attributes_no_groups
Nov 5, 2017
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enumag
reviewed
Nov 4, 2017
@@ -175,6 +175,13 @@ public function denormalize($data, $class, $format = null, array $context = arra | |||
} | |||
|
|||
$allowedAttributes = $this->getAllowedAttributes($class, $context, true); | |||
|
|||
if (false === $allowedAttributes && $this->classMetadataFactory) { |
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.
It's probably useless to do this if $context[self::ALLOW_EXTRA_ATTRIBUTES]
is not set.
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.
Right. Thanks :)
Simperfit
approved these changes
Nov 4, 2017
enumag
approved these changes
Nov 5, 2017
fabpot
approved these changes
Nov 5, 2017
Thank you @ogizanagi. |
fabpot
added a commit
that referenced
this pull request
Nov 5, 2017
…(ogizanagi) This PR was merged into the 3.3 branch. Discussion ---------- [Serializer] Fix extra attributes when no group specified | Q | A | ------------- | --- | Branch? | 3.3 <!-- see comment below --> | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #24783 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A ~~Two commits, for two possible solutions, but I think the last one is probably the most efficient one, as the first one will also impact normalization and systematically try to intersect allowedAttributes and extractedAttributes.~~ Commits ------- d1b343c [Serializer] Fix extra attributes when no group specified
This was referenced Nov 5, 2017
Merged
Merged
Merged
nicolas-grekas
added a commit
that referenced
this pull request
Mar 16, 2018
This PR was merged into the 3.4 branch. Discussion ---------- [Serializer] Remove const override | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | N/A <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | N/A This public const was moved to parent class in #24816 Commits ------- 25312c4 [Serializer] Remove const override
ogizanagi
added a commit
that referenced
this pull request
Jun 21, 2018
…mented (deviantintegral) This PR was squashed before being merged into the 3.4 branch (closes #26534). Discussion ---------- allow_extra_attributes does not throw an exception as documented | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | none | License | MIT | Doc PR | none The example at [Deserializing an object](https://symfony.com/doc/current/components/serializer.html#deserializing-an-object) does not actually work. It looks like this is a bug and not a docs issue. #24783 reported the same bug, but it looks like the fix at #24816 isn't complete. Here's a failing test that copies the existing example. Commits ------- a67b650 allow_extra_attributes does not throw an exception as documented
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two commits, for two possible solutions, but I think the last one is probably the most efficient one, as the first one will also impact normalization and systematically try to intersect allowedAttributes and extractedAttributes.