Skip to content

fix(doctrine): ignore operator-map values in ExactFilter and PartialSearchFilter#8415

Merged
soyuka merged 1 commit into
api-platform:4.3from
soyuka:fix/8407-exact-filter-associative-array-guard
Jul 22, 2026
Merged

fix(doctrine): ignore operator-map values in ExactFilter and PartialSearchFilter#8415
soyuka merged 1 commit into
api-platform:4.3from
soyuka:fix/8407-exact-filter-associative-array-guard

Conversation

@soyuka

@soyuka soyuka commented Jul 22, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 4.3
Bug fix? yes
New feature? no
Deprecations? no
Issues Fixes #8407
License MIT
Doc PR n/a

What

ExactFilter and PartialSearchFilter treated an associative (non-list) array value as an IN (...) list / a set of LIKE clauses. When one of them shares an HTTP key with an operator-map filter (ComparisonFilter, DateFilter), the operator-map form ?prop[lt]=x resolves the value to ['lt' => 'x'] for every parameter declared on that key — so the equality/partial filter injected a bogus prop 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.

if (\is_array($value) && !array_is_list($value)) {
    return;
}

Why

Reported in #8407: ExactFilter combined with DateFilter on the same property stopped working after migrating off SearchFilter, because ExactFilter fires 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 an ExactFilter and a ComparisonFilter on the same key: ?quantity=10 matches exactly, ?quantity[lt]=10 applies only the comparison. Fails before the guard (empty result), passes after. No regressions across tests/Functional/Parameters/.

…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
@soyuka

soyuka commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

superseeds #8411

@soyuka
soyuka merged commit 05c51c2 into api-platform:4.3 Jul 22, 2026
88 of 110 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant