Skip to content

fix(state): restore 422 for empty scalar params - #8675

Merged
soyuka merged 2 commits into
api-platform:4.4from
soyuka:fix/empty-value-cast-8641
Oct 13, 2026
Merged

soyuka merged 2 commits into
api-platform:4.4from
soyuka:fix/empty-value-cast-8641

Conversation

@soyuka

@soyuka soyuka commented Oct 12, 2026

Copy link
Copy Markdown
Member
Q A
Branch? 4.4
Tickets Fixes #8641 (first case, the backed enum one is #8656 on 5.0)
License MIT
Doc PR

Since #8344 ValueCaster threw a 400 on an empty value, so ?days= on an integer QueryParameter with a Choice constraint answered 400 instead of the 422 it gave on 4.3. The caster now returns '' as-is like any other value it can't cast (?days=foo), the constraint answers 422.

Without a constraint '' would then reach SQL, so the ORM and ODM ExactFilter ignore an empty value (and drop empty list entries) when the parameter isn't string typed, that's the 4.3 behavior. A string parameter still filters on ''. The empty value tests changed by #8344 are restored to their previous assertions.

Note: Laravel's EqualsFilter gets '' again on a cast int parameter, same as 4.3.

@soyuka
soyuka merged commit 5a953cb into api-platform:4.4 Oct 13, 2026
112 of 117 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