Skip to content

Route model binding broken in 11.36.0 #53952

@jasonvarga

Description

@jasonvarga

Laravel Version

11.36.0

PHP Version

8.3.14

Database Driver & Version

No response

Description

Explicit route model binding is broken in 11.36.0, specifically in #53275 in this condition and early return

When I have a route like this:

Route::get('things/{thing}', function (ThingInterface $thing) {
    dump($thing);
});

and a binding like this:

Route::bind('thing', function (string $value) {
    return new Thing($value);
});

The route parameter will try to resolve from the container rather than use what my route binding returns.

Steps To Reproduce

I have an example at https://github.com/jasonvarga/laravel-bug-pr-53275
This commit shows the proof of concept.

Visit /things/foo to see the issue. You will see a BindingResolutionException because it ignores the binding and tries to resolve through the container.

If you downgrade to the previous release (11.35.1) then you will see the returned Thing correctly dumped to the browser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions