bug #35117 [Cache] do not overwrite variable value (xabbuh)

This PR was merged into the 4.3 branch.

Discussion
----------

[Cache] do not overwrite variable value

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35030
| License       | MIT
| Doc PR        |

Commits
-------

e379dbbf21 do not overwrite variable value
This commit is contained in:
Nicolas Grekas 2019-12-28 15:53:10 +01:00
commit b6403d88c2

View File

@ -54,7 +54,7 @@ class CachePoolPass implements CompilerPassInterface
} }
$seed .= '.'.$container->getParameter('kernel.container_class'); $seed .= '.'.$container->getParameter('kernel.container_class');
$pools = []; $allPools = [];
$clearers = []; $clearers = [];
$attributes = [ $attributes = [
'provider', 'provider',
@ -119,7 +119,7 @@ class CachePoolPass implements CompilerPassInterface
$clearers[$clearer][$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE); $clearers[$clearer][$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE);
} }
$pools[$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE); $allPools[$name] = new Reference($id, $container::IGNORE_ON_UNINITIALIZED_REFERENCE);
} }
$notAliasedCacheClearerId = $this->cacheClearerId; $notAliasedCacheClearerId = $this->cacheClearerId;
@ -127,7 +127,7 @@ class CachePoolPass implements CompilerPassInterface
$this->cacheClearerId = (string) $container->getAlias($this->cacheClearerId); $this->cacheClearerId = (string) $container->getAlias($this->cacheClearerId);
} }
if ($container->hasDefinition($this->cacheClearerId)) { if ($container->hasDefinition($this->cacheClearerId)) {
$clearers[$notAliasedCacheClearerId] = $pools; $clearers[$notAliasedCacheClearerId] = $allPools;
} }
foreach ($clearers as $id => $pools) { foreach ($clearers as $id => $pools) {
@ -145,7 +145,7 @@ class CachePoolPass implements CompilerPassInterface
} }
if ($container->hasDefinition('console.command.cache_pool_list')) { if ($container->hasDefinition('console.command.cache_pool_list')) {
$container->getDefinition('console.command.cache_pool_list')->replaceArgument(0, array_keys($pools)); $container->getDefinition('console.command.cache_pool_list')->replaceArgument(0, array_keys($allPools));
} }
} }