Skip to content

fix(doctrine): keep zero-backed enum filter values - #8515

Merged
soyuka merged 1 commit into
api-platform:4.3from
ousamabenyounes:fix/issue-8475
Sep 9, 2026
Merged

fix(doctrine): keep zero-backed enum filter values#8515
soyuka merged 1 commit into
api-platform:4.3from
ousamabenyounes:fix/issue-8475

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Fix #8475

BackedEnumFilter normalized integer-backed enum query values before checking whether any valid values remained. The default array_filter() callback also removed the valid integer value 0, causing the filter to be silently skipped.

This keeps every normalized value except null, which is the sentinel returned for invalid enum values. A regression test covers zero and confirms negative values remain supported.

Test verification (RED → GREEN)

On unmodified 4.3, the new test failed for the zero-backed case:

Failed asserting that two strings are identical.
-'SELECT o FROM ApiPlatform\Doctrine\Orm\Tests\Fixtures\Entity\IntegerBackedEnumDummy o WHERE o.value = :value_p1'
+'SELECT o FROM ApiPlatform\Doctrine\Orm\Tests\Fixtures\Entity\IntegerBackedEnumDummy o'
Tests: 2, Assertions: 2, Failures: 1.

With the fix:

OK (2 tests, 2 assertions)

Full local suite

Command: ./run-ci.sh (Doctrine ORM BackedEnumFilterTest on PHP 8.4 and PHP 8.5, matching the affected component CI job).

Result: same-or-better than the upstream baseline, with no new failures, skips, ignores, or errors.

Upstream 4.3: OK (7 tests, 9 assertions)
PHP 8.4: OK (9 tests, 11 assertions)
PHP 8.5: OK (9 tests, 11 assertions)
PHP CS Fixer 3.93.1: 0 of 4 files can be fixed
Changed production lines: 100% covered (1/1)

@soyuka
soyuka merged commit c75e1c1 into api-platform:4.3 Sep 9, 2026
112 checks passed
@soyuka

soyuka commented Sep 9, 2026

Copy link
Copy Markdown
Member

thanks!

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