-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[8.x] Fix array keys from cached routes #42078
Conversation
I don't think this is valid? Seems like existing tests are breaking because of this PR. |
@glamorous please provide a bullet point list of steps to take in a fresh Laravel application to recreate the bug. Also please mark this PR as ready for review when you have done so. |
|
It indeed seems that this is the correct fix. We'll need to adjust the tests and also version the routes file anew to make sure existing cached route files aren't conflicting with this change. |
I'll try to find some time this weekend to check which tested needs an update |
Can we get a test on this? |
Introduced by laravel#35714. Removed the slash to match the same array key as in src/Illuminate/Routing/RouteCollection.php:60
36c59ff
to
5b98b72
Compare
There was just a test that needed the fix as well to match the changed code. If merged, I can cherry-pick for 9.x |
@taylorotwell there were tests for this, they've now been changed to the new behavior 👍 |
Introduced by laravel#35714. Removed the slash to match the same array key as in src/Illuminate/Routing/RouteCollection.php:60
Introduced by #35714.
Removed the slash to match the same array key as in
src/Illuminate/Routing/RouteCollection.php:60
We noticed a different result when we used route caching for in this code piece:
Only routes with a specified domain where affected and a the result array of "->get('GET')" would not have the same array keys. Check next example with uri "test" and domain "{tenant}.laravel.test", this would give these two different results if you use cached router or not:
"{tenant}.laravel.test/test" => cached
"{tenant}.laravel.testtest" => not cached
The check for the existing of a domain is not necessary because the "->getDomain" function can return
null
as well and wil result in empty string (just like it behaves in the non compiled RouteCollection).If approved & merged, I can cherry-pick it for 9.x release as well.