8000 [Routing] Fix using a custom matcher & generator dumper class · symfony/symfony@3a840a9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a840a9

Browse files
committed
[Routing] Fix using a custom matcher & generator dumper class
1 parent 1e4e0ec commit 3a840a9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Symfony/Component/Routing/Router.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public function getMatcher()
291291
return $this->matcher;
292292
}
293293

294-
$compiled = is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) && (UrlMatcher::class === $this->options['matcher_base_class'] || RedirectableUrlMatcher::class === $this->options['matcher_base_class']);
294+
$compiled = is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) && (UrlMatcher::class === $this->options['matcher_base_class'] || RedirectableUrlMatcher::class === $this->options['matcher_base_class']) && is_a($this->options['matcher_dumper_class'], CompiledUrlMatcherDumper::class, true);
295295

296296
if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) {
297297
$routes = $this->getRouteCollection();
@@ -348,7 +348,7 @@ public function getGenerator()
348348
return $this->generator;
349349
}
350350

351-
$compiled = is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) && UrlGenerator::class === $this->options['generator_base_class'];
351+
$compiled = is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) && UrlGenerator::class === $this->options['generator_base_class'] && is_a($this->options['generator_dumper_class'], CompiledUrlGeneratorDumper::class, true);
352352

353353
if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) {
354354
$routes = $this->getRouteCollection();
@@ -398,8 +398,8 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac
398398
*/
399399
protected function getGeneratorDumperInstance()
400400
{
401-
// For BC, fallback to PhpGeneratorDumper if the UrlGenerator and UrlGeneratorDumper are not consistent with each other
402-
if (is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) !== is_a($this->options['generator_dumper_class'], CompiledUrlGeneratorDumper::class, true)) {
401+
// For BC, fallback to PhpGeneratorDumper (which is the old default value) if the old UrlGenerator is used with the new default CompiledUrlGeneratorDumper
402+
if (!is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) && is_a($this->options['generator_dumper_class'], CompiledUrlGeneratorDumper::class, true)) {
403403
return new PhpGeneratorDumper($this->getRouteCollection());
404404
}
405405

@@ -411,8 +411,8 @@ protected function getGeneratorDumperInstance()
411411
*/
412412
protected function getMatcherDumperInstance()
413413
{
414-
// For BC, fallback to PhpMatcherDumper if the UrlMatcher and UrlMatcherDumper are not consistent with each other
415-
if (is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) !== is_a($this->options['matcher_dumper_class'], CompiledUrlMatcherDumper::class, true)) {
414+
// For BC, fallback to PhpMatcherDumper (which is the old default value) if the old UrlMatcher is used with the new default CompiledUrlMatcherDumper
415+
if (!is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) && is_a($this->options['matcher_dumper_class'], CompiledUrlMatcherDumper::class, true)) {
416416
return new PhpMatcherDumper($this->getRouteCollection());
417417
}
418418

0 commit comments

Comments
 (0)
0