Skip to content

Commit f04a741

Browse files
[Routing] Fix simple parameter mappings in routes
1 parent 12239a3 commit f04a741

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/Symfony/Component/Routing/Route.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ private function extractInlineDefaultsAndRequirements(string $pattern): string
426426
$this->setRequirement($m[2], substr($m[6], 1, -1));
427427
}
428428
if (isset($m[4][0])) {
429-
$mapping[$m[2]] = isset($m[5][0]) ? [$m[4], substr($m[5], 1)] : $mapping[$m[2]] = [$m[4], $m[2]];
429+
$mapping[$m[2]] = isset($m[5][0]) ? [$m[4], substr($m[5], 1)] : $m[4];
430430
}
431431

432432
return '{'.$m[1].$m[2].'}';

src/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,10 +1046,7 @@ public function testMapping()
10461046
'_route' => 'a',
10471047
'slug' => 'vienna-2024',
10481048
'_route_mapping' => [
1049-
'slug' => [
1050-
'conference',
1051-
'slug',
1052-
],
1049+
'slug' => 'conference',
10531050
],
10541051
];
10551052
$this->assertEquals($expected, $matcher->match('/conference/vienna-2024'));

0 commit comments

Comments
 (0)