Skip to content

fix(laravel): ignore a non-string JSON:API include parameter - #8904

Merged
soyuka merged 1 commit into
api-platform:5.0from
BenMacha:fix-laravel-jsonapi-include-array-5-0
Dec 1, 2026
Merged

soyuka merged 1 commit into
api-platform:5.0from
BenMacha:fix-laravel-jsonapi-include-array-5-0

Conversation

@BenMacha

Copy link
Copy Markdown
Contributor
Q A
Branch? 5.0
Tickets -
License MIT
Doc PR -

With the JSON:API format, the Laravel JsonApiProvider passes include straight to explode(), so an array crashes the request:

GET /api/books?include[]=author
Accept: application/vnd.api+json
  • before: 500, TypeError: explode(): Argument #2 ($string) must be of type string, array given
  • after: 200, the parameter is ignored (no included member), same as the core ApiPlatform\JsonApi\State\JsonApiProvider, which already checks is_string()

?include=author works as before. Covered by testIncludeAsArrayIsIgnored in src/Laravel/Tests/JsonApiTest.php.

?include[]=author passed an array to explode() in the Laravel JsonApiProvider and raised a
TypeError (500). Only a string include is used now, as in the core JsonApiProvider.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-30T08:57:46.402151Z
We couldn’t complete this review. Comment @codex review to try again.
decac13 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@BenMacha
BenMacha force-pushed the fix-laravel-jsonapi-include-array-5-0 branch from decac13 to 0820991 Compare November 30, 2026 12:36
@soyuka
soyuka merged commit 3ead986 into api-platform:5.0 Dec 1, 2026
107 of 117 checks passed
@soyuka

soyuka commented Dec 1, 2026

Copy link
Copy Markdown
Member

I'll create a follow up pr to hardenen this even more thanks for the patch!

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