Skip to content

fix(doctrine): ignore associative values in exact filter#8411

Closed
ousamabenyounes wants to merge 4 commits into
api-platform:mainfrom
ousamabenyounes:fix-8407-exact-filter-associative-values
Closed

fix(doctrine): ignore associative values in exact filter#8411
ousamabenyounes wants to merge 4 commits into
api-platform:mainfrom
ousamabenyounes:fix-8407-exact-filter-associative-values

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #8407
License MIT
Doc PR n/a

Summary

ExactFilter treated any array value as an IN (...) filter. When another filter sharing the same query key receives an associative value, such as DateFilter's createdAt[strictly_before]=..., ExactFilter consumed that associative array first and added an incorrect IN clause.

This makes ExactFilter ignore associative arrays and keep handling scalar values and list arrays.

Local review

Reviewed before opening this PR. No findings: the guard is before property validation/DQL generation, so associative values meant for another filter are skipped; the existing functional ExactFilter test suite still passes for current scalar/list behavior.

Test verification (RED → GREEN)

RED, after adding the regression test on upstream main:

F                                                                   1 / 1 (100%)

1) ApiPlatform\Doctrine\Orm\Tests\Filter\ExactFilterTest::testExactFilterIgnoresAssociativeArrayValues
Doctrine\ORM\QueryBuilder::andWhere('o.dummyDate IN (:dummyDate_p1)'): static was not expected to be called.

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

GREEN, with the fix:

.                                                                   1 / 1 (100%)

OK (1 test, 1 assertion)

Fix-reverted regression check:

F                                                                   1 / 1 (100%)

ApiPlatform\Doctrine\Orm\Tests\Filter\ExactFilterTest::testExactFilterIgnoresAssociativeArrayValues
Doctrine\ORM\QueryBuilder::andWhere('o.dummyDate IN (:dummyDate_p1)'): static was not expected to be called.

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

Additional checks:

php vendor/bin/phpunit tests/Functional/Parameters/ExactFilterTest.php
OK (20 tests, 65 assertions)

php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --allow-unsupported-php-version=yes --dry-run --diff src/Doctrine/Orm/Filter/ExactFilter.php src/Doctrine/Orm/Tests/Filter/ExactFilterTest.php
Found 0 of 2 files that can be fixed

php vendor/bin/phpstan analyse src/Doctrine/Orm/Filter/ExactFilter.php src/Doctrine/Orm/Tests/Filter/ExactFilterTest.php
[OK] No errors

All commands were run inside ephemeral Docker containers with docker run --rm -u "$(id -u):$(id -g)" -v "$PWD":/app -w /app composer:2 ....

@soyuka

soyuka commented Jul 22, 2026

Copy link
Copy Markdown
Member

thanks, superseeded by #8415

@soyuka soyuka closed this Jul 22, 2026
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.

2 participants