Skip to content

Commit 08b9ce3

Browse files
Merge branch '4.3' into 4.4
* 4.3: Fix more bad tests Fix test fixtures with deprecated method signatures. Fix 4.3 tests forward compat [Messenger] fix empty amqp body returned as false Fix routing cache broken when using generator_class
2 parents fda0068 + 0a6b9b6 commit 08b9ce3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Router.php

Lines 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;
@@ -388,6 +390,11 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac
388390
*/
389391
protected function getGeneratorDumperInstance()
390392
{
393+
// For BC, fallback to PhpGeneratorDumper if the UrlGenerator and UrlGeneratorDumper are not consistent with each other
394+
if (is_a($this->options['generator_class'], CompiledUrlGenerator::class, true) !== is_a($this->options['generator_dumper_class'], CompiledUrlGeneratorDumper::class, true)) {
395+
return new PhpGeneratorDumper($this->getRouteCollection());
396+
}
397+
391398
return new $this->options['generator_dumper_class']($this->getRouteCollection());
392399
}
393400

@@ -396,6 +403,11 @@ protected function getGeneratorDumperInstance()
396403
*/
397404
protected function getMatcherDumperInstance()
398405
{
406+
// For BC, fallback to PhpMatcherDumper if the UrlMatcher and UrlMatcherDumper are not consistent with each other
407+
if (is_a($this->options['matcher_class'], CompiledUrlMatcher::class, true) !== is_a($this->options['matcher_dumper_class'], CompiledUrlMatcherDumper::class, true)) {
408+
return new PhpMatcherDumper($this->getRouteCollection());
409+
}
410+
399411
return new $this->options['matcher_dumper_class']($this->getRouteCollection());
400412
}
401413

0 commit comments

Comments
 (0)