Skip to content

Commit d363435

Browse files
authored
fix array keys from cached routes (#42078)
Introduced by #35714. Removed the slash to match the same array key as in src/Illuminate/Routing/RouteCollection.php:60
1 parent 6fea6c2 commit d363435

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/Illuminate/Routing/CompiledRouteCollection.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,7 @@ public function getRoutesByMethod()
252252
})
253253
->map(function (Collection $routes) {
254254
return $routes->mapWithKeys(function (Route $route) {
255-
if ($domain = $route->getDomain()) {
256-
return [$domain.'/'.$route->uri => $route];
257-
}
258-
259-
return [$route->uri => $route];
255+
return [$route->getDomain().$route->uri => $route];
260256
})->all();
261257
})
262258
->all();

tests/Integration/Routing/CompiledRouteCollectionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,13 @@ public function testRouteWithSamePathAndSameMethodButDiffDomainNameWithOptionsMe
527527

528528
$this->assertEquals([
529529
'HEAD' => [
530-
'foo.localhost/same/path' => $routes['foo_domain'],
531-
'bar.localhost/same/path' => $routes['bar_domain'],
530+
'foo.localhostsame/path' => $routes['foo_domain'],
531+
'bar.localhostsame/path' => $routes['bar_domain'],
532532
'same/path' => $routes['no_domain'],
533533
],
534534
'GET' => [
535-
'foo.localhost/same/path' => $routes['foo_domain'],
536-
'bar.localhost/same/path' => $routes['bar_domain'],
535+
'foo.localhostsame/path' => $routes['foo_domain'],
536+
'bar.localhostsame/path' => $routes['bar_domain'],
537537
'same/path' => $routes['no_domain'],
538538
],
539539
], $this->collection()->getRoutesByMethod());

0 commit comments

Comments
 (0)