-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Package breaks applications using the HasMiddleware interface #662
Comments
Is there a way to disable tracing to prevent the exception from being thrown? Setting |
To answer your question, you can disable autodiscovery for I am investigating how to fix this... stay tuned! |
So I've been diving in the Laravel source for this, For reference, this is the interface: https://github.com/laravel/framework/blob/136ed754f2d80e5c7cd407a4262eb2eac478e7e8/src/Illuminate/Routing/Controllers/HasMiddleware.php and you can return middleware extending this class from the implemented method: https://github.com/laravel/framework/blob/136ed754f2d80e5c7cd407a4262eb2eac478e7e8/src/Illuminate/Routing/Controllers/Middleware.php. The "problem" is that in the It seems like this is an oversight on the Laravel implementation where this method should not live on the dispatcher class, we probably implement a fix for this to proxy through the static method call, and file a PR to the Laravel core to refactor this because I don't think we are doing anything wrong. |
I think this is a Laravel bug, so I've submitted a PR: laravel/framework#46498. I also have a fix ready to work around this if needed but I feel like this is more of a hack than a good solution so I'd rather see the fix implemented in the Laravel framework instead if possible. |
The PR to the Laravel framework has been merged, I'll keep this open for reference a bit until it's released It's fixed with Laravel 10.4.0 🎉 Thanks for reporting! |
Thank you so much for investigating this in detail and submitting the PR into the Laravel Framework. Much appreciated @stayallive |
Environment
Laravel v9
Sentry Laravel v3.3
Steps to Reproduce
HasMiddleware
interface and has at least one middleware defined in the controllermiddleware()
method.Expected Result
The route should load.
Actual Result
Exception is thrown.
Call to undefined method Sentry\Laravel\Tracing\Routing\TracingControllerDispatcherTracing::methodExcludedByOptions()
Links
laravel/framework#44516
https://www.amitmerchant.com/resolving-middlewares-statically-from-controllers-in-laravel-9x/
The text was updated successfully, but these errors were encountered: