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 3247fbf

Browse filesBrowse files
author
dFayet
committed
Fix routing cache broken when using generator_class
1 parent 2b8e441 commit 3247fbf
Copy full SHA for 3247fbf

File tree

1 file changed

+13
-0
lines changed
Filter options

1 file changed

+13
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Router.php
+13Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.