Skip to content

Commit e904ab8

Browse files
committed
bug symfony#22376 [FrameworkBundle] Use findDefinition() instead of getDefinition() on aliases (chalasr)
This PR was merged into the 3.3-dev branch. Discussion ---------- [FrameworkBundle] Use findDefinition() instead of getDefinition() on aliases | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a The services for which `has()` is called might be aliases at this point so `getDefinition()` gives an exception, I ran into by executing this pass but not the removing ones (skipping ReplaceAliasByActualDefinitionPass) while working on symfony#16388. Let's make it safe to use independently. Commits ------- 41f3d1f Use findDefinition() instead of getDefinition() after calling has()
2 parents a6dbc39 + 41f3d1f commit e904ab8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolClearerPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ public function process(ContainerBuilder $container)
5656
return;
5757
}
5858
$factory = array(AbstractAdapter::class, 'createSystemCache');
59-
$annotationsPool = $container->getDefinition('cache.annotations');
59+
$annotationsPool = $container->findDefinition('cache.annotations');
6060
if ($factory !== $annotationsPool->getFactory() || 4 !== count($annotationsPool->getArguments())) {
6161
return;
6262
}
6363
if ($container->has('monolog.logger.cache')) {
6464
$annotationsPool->addArgument(new Reference('monolog.logger.cache'));
6565
} elseif ($container->has('cache.system')) {
66-
$systemPool = $container->getDefinition('cache.system');
66+
$systemPool = $container->findDefinition('cache.system');
6767
if ($factory === $systemPool->getFactory() && 5 <= count($systemArgs = $systemPool->getArguments())) {
6868
$annotationsPool->addArgument($systemArgs[4]);
6969
}

0 commit comments

Comments
 (0)