Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dde442f

Browse filesBrowse files
committed
[Routing][PrefixTrait] Add the _locale requirement
1 parent e464954 commit dde442f
Copy full SHA for dde442f

File tree

1 file changed

+1
-0
lines changed
Filter options

1 file changed

+1
-0
lines changed

‎src/Symfony/Component/Routing/Loader/Configurator/Traits/PrefixTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/Configurator/Traits/PrefixTrait.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ final protected function addPrefix(RouteCollection $routes, $prefix, bool $trail
3333
foreach ($prefix as $locale => $localePrefix) {
3434
$localizedRoute = clone $route;
3535
$localizedRoute->setDefault('_locale', $locale);
36+
$localizedRoute->setRequirement('_locale', preg_quote($locale));
3637
$localizedRoute->setDefault('_canonical_route', $name);
3738
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
3839
$routes->add($name.'.'.$locale, $localizedRoute);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.