Skip to content

Update: Fix Error spatie/laravel-missing-page-redirector #44568

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

Closed
wants to merge 1 commit into from

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