Skip to content

Conversation

@vdvcoder
Copy link

Since update from Laravel 9.32 to 9.33 the package spatie/laravel-missing-page-redirector did not work anymore.

This should fix it.

Since update from Laravel 9.32 to 9.33 the package spatie/laravel-missing-page-redirector did not work anymore.

This should fix it.
@rodrigopedra
Copy link
Contributor

Sent PR spatie/laravel-missing-page-redirector#78 to spatie/laravel-missing-page-redirector as an alternative to address this same issue.

@timacdonald you may want to look on the reasoning on that PR.

For short, as PR #44339 introduced the Illuminate/Routing/Contracts/CallableDispatcher, empty containers -- such as the default to Illuminate\Routing\Router when no container instance is provided to its constructor -- would fail to dispatch closure based routes as they won't know how to build this interface.

I believe this is kind of a breaking change, as maybe other packages using private Router instances, for similar reasons as the package linked above, could start failing to dispatch closure based routes.

As this ship has been sailed already, maybe we could consider changing this line on Illuminate\Routing\Router's constructor:

$this->container = $container ?: new Container;

To

$this->container = $container ?: Container::getInstance();

So at least when no container is provided it uses the global one instead, and avoid this issue. What do you think?

@rodrigopedra
Copy link
Contributor

Or the alternative would be dropping the new Illuminate/Routing/Contracts/CallableDispatcher interface, as the introduced Illuminate\Foundation\Routing\PrecognitionCallableDispatcher is a sub-class for this new interface only subclass Illuminate\Routing\CallableDispatcher

Instead of binding to the interface, and dispatching an interface that might be unbounded on the container, we ask the container for the concrete class, and PrecognitionServiceProvider can alias/rebind its subclass when needed.

@taylorotwell
Copy link
Member

Looks like an alternative was merged to the package itself.

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.

3 participants