fix(doctrine): ignore operator-map values in ExactFilter and PartialSearchFilter#8415
Merged
soyuka merged 1 commit intoJul 22, 2026
Conversation
…earchFilter Both filters treated an associative array as an IN list / LIKE set. When they share an HTTP key with an operator-map filter (ComparisonFilter, DateFilter), the `?prop[lt]=x` form resolves the value to ['lt' => x] for every parameter on that key, so the equality filter injected a bogus `prop IN (...)` on top of the comparison. Guard both: a non-list array is an operator map owned by ComparisonFilter/DateFilter, not equality. Fixes api-platform#8407
Member
Author
|
superseeds #8411 |
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.
What
ExactFilterandPartialSearchFiltertreated an associative (non-list) array value as anIN (...)list / a set ofLIKEclauses. When one of them shares an HTTP key with an operator-map filter (ComparisonFilter,DateFilter), the operator-map form?prop[lt]=xresolves the value to['lt' => 'x']for every parameter declared on that key — so the equality/partial filter injected a bogusprop IN ('lt' => ...)on top of the intended comparison, silently returning wrong results (usually zero rows).Both filters now skip associative arrays: a non-list array is an operator map owned by
ComparisonFilter/DateFilter, not equality.Why
Reported in #8407:
ExactFiltercombined withDateFilteron the same property stopped working after migrating offSearchFilter, becauseExactFilterfires on the bracketed date syntax too. The guard makes the equality/partial filters ignore value shapes that aren't theirs, so combining them with an operator-map filter fails safe.Test
New functional test
DoctrineTest::testExactFilterIgnoresOperatorMap()with a fixture declaring anExactFilterand aComparisonFilteron the same key:?quantity=10matches exactly,?quantity[lt]=10applies only the comparison. Fails before the guard (empty result), passes after. No regressions acrosstests/Functional/Parameters/.