Repository navigation
Replies: 1 comment
|
I don't see any good solution for this at the moment.
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Laravel Version
13.6.0
PHP Version
8.5.5
Database Driver & Version
n/a
Description
When referring to a controller method by just a name inside a route group, with this method name being the same as a registered global alias from a Facade, an exception may occur.
I've been able to trace this back to the following clause returning true:
framework/src/Illuminate/Routing/Router.php
Lines 664 to 666 in 9f3dc9f
As
class_existsdoes comparisons case-insensitive, this might yield true for all casings of Facade alias and other global aliases. However, likely due to the lazy loading nature of these, an immediateclass_exists('request')call will be false, up until the point where an actual reference to theRequestclass has been observed, after which all casings will return the same result.This is likely very low impact, as I've only managed to achieve this in testing (with cached routes I figure it is unlikely to happen due to loading orders) and moreover requires some oddly specific method names, although
requestmight be out in the wild somewhere else...Steps To Reproduce
request.class_exists('Request')ornew \Request().Route::groupcall setting the controller above, which contains aRoute::get(or any method really) call that maps to the method from above.jnoordsij/laravel-laravel@06d05e4 contains a minimal test achieving this.
All reactions