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 a5b46e5

Browse filesBrowse files
dFayetnicolas-grekas
dFayet
authored andcommitted
Fix routing cache broken when using generator_class
1 parent b9f8c7b commit a5b46e5
Copy full SHA for a5b46e5

File tree

1 file changed

+12
-0
lines changed
Filter options

1 file changed

+12
-0
lines changed

‎src/Symfony/Component/Routing/Router.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Router.php
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
use Symfony\Component\Routing\Generator\ConfigurableRequirementsInterface;
2424
use Symfony\Component\Routing\Generator\Dumper\CompiledUrlGeneratorDumper;
2525
use Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface;
26+
use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper;
2627
use Symfony\Component\Routing\Generator\UrlGenerator;
2728
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2829
use Symfony\Component\Routing\Matcher\CompiledUrlMatcher;
2930
use Symfony\Component\Routing\Matcher\Dumper\CompiledUrlMatcherDumper;
3031
use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface;
32+
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
3133
use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
3234
use Symfony\Component\Routing\Matcher\UrlMatcher;
3335
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
@@ -394,6 +396,11 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac
394396
*/
395397
protected function getGeneratorDumperInstance()
396398
{
399+
// For BC, fallback to PhpGeneratorDumper if the UrlGenerator and UrlGeneratorDumper are not consistent with each other
400+
if (is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) !== is_a($this->options['generator_dumper_class'], CompiledUrlGeneratorDumper::class, true)) {
401+
return new PhpGeneratorDumper($this->getRouteCollection());
402+
}
403+
397404
return new $this->options['generator_dumper_class']($this->getRouteCollection());
398405
}
399406

@@ -402,6 +409,11 @@ protected function getGeneratorDumperInstance()
402409
*/
403410
protected function getMatcherDumperInstance()
404411
{
412+
// For BC, fallback to PhpMatcherDumper if the UrlMatcher and UrlMatcherDumper are not consistent with each other
413+
if (is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) !== is_a($this->options['matcher_dumper_class'], CompiledUrlMatcherDumper::class, true)) {
414+
return new PhpMatcherDumper($this->getRouteCollection());
415+
}
416+
405417
return new $this->options['matcher_dumper_class']($this->getRouteCollection());
406418
}
407419

0 commit comments

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