[8.x] Fix array keys from cached routes#42078
[8.x] Fix array keys from cached routes#42078taylorotwell merged 1 commit intolaravel:8.xfrom glamorous:fix-route-caching
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 #35714. Removed the slash to match the same array key as in src/Illuminate/Routing/RouteCollection.php:60
|
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 #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
nullas 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.