Skip to content

fix(laravel): return 400 for invalid IRIs and serializer errors - #8805

Merged
soyuka merged 3 commits into
api-platform:5.0from
Maxcastel:fix/laravel-client-errors-status
Nov 6, 2026
Merged

soyuka merged 3 commits into
api-platform:5.0from
Maxcastel:fix/laravel-client-errors-status

Conversation

@Maxcastel

@Maxcastel Maxcastel commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor
Q A
Branch? 5.0
License MIT
Doc PR api-platform/docs#2365

Two client errors had a wrong status with Laravel:

  • an IRI that matches no route ({"author": "/api/nope/1"}) gave a 404, the NotFoundHttpException of the Laravel router went through. Router::match() now throws the RouterInterface exceptions and the IRI converter turns them into an InvalidArgumentException, like on Symfony.
  • serializer errors (a wrong type in the body, an invalid IRI...) gave a 500, the Laravel defaults of exception_to_status only had the auth exceptions. I added the same 400 defaults as Symfony, plus a fallback in the error renderer for apps that already published their config.

@soyuka
soyuka merged commit fceb40b into api-platform:5.0 Nov 6, 2026
110 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.

2 participants