fix: resolve union in types#8334
Draft
Cafeine42 wants to merge 2 commits into
Draft
Conversation
added 2 commits
June 19, 2026 10:21
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
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.
Affected versions
6bcbeb2db)is_aguard from 6bcbeb2 breaks union-typed collectionsThe security fix in
6bcbeb2db(GHSA-9rjg-x2p2-h68h, v4.3.13) added anis_a()guard inAbstractItemNormalizer::getResourceFromIri()(src/Serializer/AbstractItemNormalizer.php:762). It's too strict for union-typed collections likearray<Foo|Bar>.Cause: in
createAndValidateAttributeValue()each candidate type is tried in turn. The guard makesdenormalizeObjectCollection()throw on the first item that doesn't match the single type being tried.Foo[]fails on the firstBar,Bar[]fails on the firstFoo, so no iteration can succeed. The error is then re-wrapped at the collection level (pathitems) instead of item level (items[2]).Impact:
[foo, foo, bar]) is now systematically rejected.Affected: works in v4.3.10, broken in v4.3.13.
Suggested fix: make the
is_aguard union-aware — pass all possible union types to the check, or preserve the item-level error path. The security fix itself must be kept.Reproduce
array<Foo|Bar>exposed via API Platform.items[2]; v4.3.13 → whole collection rejected.