Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route model binding broken in 11.36.0 #53952

Closed
jasonvarga opened this issue Dec 17, 2024 · 2 comments
Closed

Route model binding broken in 11.36.0 #53952

jasonvarga opened this issue Dec 17, 2024 · 2 comments
Labels

Comments

@jasonvarga
Copy link
Contributor

jasonvarga commented Dec 17, 2024

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.

@crynobone
Copy link
Member

Fixed in v11.36.1: https://github.com/laravel/framework/releases/tag/v11.36.1

@jasonvarga
Copy link
Contributor Author

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants