Skip to content

Commit 1cd5ae5

Browse files
Merge branch '5.0'
* 5.0: [FrameworkBundle] Fix session.attribute_bag service definition [Routing] Remove unused properties from the Route annotation [Routing] Add missing _locale requirements Update LdapBindAuthenticationProvider.php Add reproducer to for hit after update expire cacheItem [Cache] fix FilesystemTagAwareAdapter failing when a tag link preexists
2 parents f3276b9 + 9b18480 commit 1cd5ae5

File tree

7 files changed

+11
-3
lines changed

7 files changed

+11
-3
lines changed

Annotation/Route.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class Route
3131
private $methods = [];
3232
private $schemes = [];
3333
private $condition;
34-
private $locale;
35-
private $format;
36-
private $utf8;
3734
private $priority;
3835

3936
/**

Loader/Configurator/ImportConfigurator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Routing\Loader\Configurator;
1313

1414
use Symfony\Component\Routing\RouteCollection;
15+
use Symfony\Component\Routing\RouteCompiler;
1516

1617
/**
1718
* @author Nicolas Grekas <p@tchwork.com>

Loader/Configurator/Traits/PrefixTrait.php

Lines 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, RouteCompiler::REGEX_DELIMITER));
3637
$localizedRoute->setDefault('_canonical_route', $name);
3738
$localizedRoute->setPath($localePrefix.(!$trailingSlashOnRoot && '/' === $route->getPath() ? '' : $route->getPath()));
3839
$routes->add($name.'.'.$locale, $localizedRoute);

Tests/Fixtures/php_dsl_sub_i18n.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88

99
$add('foo', ['fr' => '/foo']);
1010
$add('bar', ['fr' => '/bar']);
11+
12+
$routes->add('non_localized', '/non-localized');
1113
};

Tests/Loader/PhpFileLoaderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public function testRoutingI18nConfigurator()
237237
$expectedCollection->add('baz.en', (new Route('/baz'))->setDefaults(['_locale' => 'en', '_canonical_route' => 'baz'])->setRequirement('_locale', 'en'));
238238
$expectedCollection->add('c_foo.fr', (new Route('/ench/pub/foo'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_foo'])->setRequirement('_locale', 'fr'));
239239
$expectedCollection->add('c_bar.fr', (new Route('/ench/pub/bar'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'c_bar'])->setRequirement('_locale', 'fr'));
240+
$expectedCollection->add('non_localized.fr', (new Route('/ench/non-localized'))->setDefaults(['_locale' => 'fr', '_canonical_route' => 'non_localized'])->setRequirement('_locale', 'fr'));
240241

241242
$expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_sub_i18n.php')));
242243
$expectedCollection->addResource(new FileResource(realpath(__DIR__.'/../Fixtures/php_dsl_i18n.php')));

Tests/Loader/XmlFileLoaderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ public function testLocalizedImportsOfNotLocalizedRoutes()
205205

206206
$this->assertEquals('/le-prefix/suffix', $routeCollection->get('imported.fr')->getPath());
207207
$this->assertEquals('/the-prefix/suffix', $routeCollection->get('imported.en')->getPath());
208+
209+
$this->assertSame('fr', $routeCollection->get('imported.fr')->getRequirement('_locale'));
210+
$this->assertSame('en', $routeCollection->get('imported.en')->getRequirement('_locale'));
208211
}
209212

210213
/**

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ public function testImportingNonLocalizedRoutesWithLocales()
338338
$this->assertCount(2, $routes);
339339
$this->assertEquals('/nl/imported', $routes->get('imported.nl')->getPath());
340340
$this->assertEquals('/en/imported', $routes->get('imported.en')->getPath());
341+
342+
$this->assertSame('nl', $routes->get('imported.nl')->getRequirement('_locale'));
343+
$this->assertSame('en', $routes->get('imported.en')->getRequirement('_locale'));
341344
}
342345

343346
public function testImportingRoutesWithOfficialLocales()

0 commit comments

Comments
 (0)