Skip to content

[13.x] Fix Builder::with() when a null callback is passed explicitly - #61769

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
lazerg:fix/issue-61762-with-null-callback
Sep 28, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
lazerg:fix/issue-61762-with-null-callback

Conversation

@lazerg

@lazerg lazerg commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Calling with('posts', null) with an explicit null callback currently adds a second eager load for relation 0, because the string branch passes func_get_args() straight through, null included. The query then fails with "Method name must be a string". This comes up when a custom builder overrides with($relations, $callback = null) and forwards both arguments to the parent.

The fix filters the null out of the arguments before parsing them.

Fixes #61762

@taylorotwell
taylorotwell merged commit a10e706 into laravel:13.x Sep 28, 2026
62 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.

With in Eloquent/Builder fails when passing callback as null instead of calling it with only relations.

2 participants