Skip to content

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

Closed

Description

@JasperKrom

Laravel Version

12 and 13

PHP Version

8.4

Database Driver & Version

No response

Description

When calling $Builder->with($relations, null) explicitly func_get_args() incorrectly interprets null as 0 if $relations is a string. We had this because we extended the builder and had a with($relations, $callback = null) signature ourselves which called parent::with($relations, $callback), thus passing the null generated from our own default, instead of letting the parent generate its null default.

Steps To Reproduce

Call any builder::with() method with a string in relations and null passed explicitly to callback instead of defaulting to null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions