bug #29191 [Routing] generate(null) should throw an exception (nicolas-grekas)

This PR was merged into the 4.1 branch.

Discussion
----------

[Routing] generate(null) should throw an exception

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #28634
| License       | MIT
| Doc PR        | -

Commits
-------

710aafbc91 [Routing] generate(null) should throw an exception
This commit is contained in:
Nicolas Grekas 2018-11-13 19:51:21 +01:00
commit c96325ff57
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ EOF;
?? $this->context->getParameter('_locale')
?: $this->defaultLocale;
if (null !== $locale && (self::$declaredRoutes[$name.'.'.$locale][1]['_canonical_route'] ?? null) === $name) {
if (null !== $locale && (self::$declaredRoutes[$name.'.'.$locale][1]['_canonical_route'] ?? null) === $name && null !== $name) {
unset($parameters['_locale']);
$name .= '.'.$locale;
} elseif (!isset(self::$declaredRoutes[$name])) {