Skip to content

fix: don't treat array datasets as callables - #1848

Open
lazerg wants to merge 1 commit into
pestphp:5.xfrom
lazerg:fix/issue-1847-two-element-dataset
Open

fix: don't treat array datasets as callables#1848
lazerg wants to merge 1 commit into
pestphp:5.xfrom
lazerg:fix/issue-1847-two-element-dataset

Conversation

@lazerg

@lazerg lazerg commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What:

  • Bug Fix
  • New Feature

Description:

A dataset of exactly two class strings, such as ->with([Project::class, User::class]), is also a valid PHP callable array when the first class has __callStatic, which every Eloquent model does. DatasetsRepository::processDatasets() runs its is_callable() check before the iterable handling, so it called Project::User() rather than using the two values, and the test died inside Eloquent. Arrays are now skipped by that check.

One or three values, keyed values, or nested arrays never matched the callable-array shape, which is why only this case failed.

Related:

Fixes #1847

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.

[Bug]: 2 unkeyed (Model::class) datasets fail

1 participant