10000 Fix routing cache broken when using generator_class · symfony/symfony@3247fbf · GitHub
[go: up one dir, main page]

Skip to content

Commit 3247fbf

Browse files
author
dFayet
committed
Fix routing cache broken when using generator_class
1 parent 2b8e441 commit 3247fbf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Symfony/Component/Routing/Router.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,19 @@ public function setOptions(array $options)
162162
if ($invalid) {
163163
throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('", "', $invalid)));
164164
}
165+
166+
// This prevent a BC break introduced in 4.3.0
167+
// Fallback to PhpGeneratorDumper if the UrlGenerator and UrlGeneratorDumper are not consistent with each other
168+
if (is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) !==
169+
is_a($this->options['generator_dumper_class'], CompiledUrlGeneratorDumper::class, true)) {
170+
$this->options['generator_dumper_class'] = 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper';
171+
}
172+
173+
// Fallback to PhpGeneratorDumper if the UrlMatcher and UrlMatcherDumper are not consistent with each other
174+
if (is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) !==
175+
is_a($this->options['matcher_dumper_class'], CompiledUrlMatcherDumper::class, true)) {
176+
$this->options['matcher_dumper_class'] = 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper';
177+
}
165178
}
166179

167180
/**

0 commit comments

Comments
 (0)
0