Skip to content

Commit 02f5339

Browse files
committed
fix merging container builder
1 parent 1e4f185 commit 02f5339

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,13 @@ public function merge(self $container)
605605
}
606606
}
607607
$this->addAliases($container->getAliases());
608-
$this->getParameterBag()->add($container->getParameterBag()->all());
608+
$parameterBag = $this->getParameterBag();
609+
$otherBag = $container->getParameterBag();
610+
$parameterBag->add($otherBag->all());
611+
612+
foreach ($otherBag->allDeprecated() as $name => $deprecated) {
613+
$parameterBag->deprecate($name, $deprecated['package'], $deprecated['version'], $deprecated['message']);
614+
}
609615

610616
if ($this->trackResources) {
611617
foreach ($container->getResources() as $resource) {
@@ -621,9 +627,9 @@ public function merge(self $container)
621627
$this->extensionConfigs[$name] = array_merge($this->extensionConfigs[$name], $container->getExtensionConfig($name));
622628
}
623629

624-
if ($this->getParameterBag() instanceof EnvPlaceholderParameterBag && $container->getParameterBag() instanceof EnvPlaceholderParameterBag) {
625-
$envPlaceholders = $container->getParameterBag()->getEnvPlaceholders();
626-
$this->getParameterBag()->mergeEnvPlaceholders($container->getParameterBag());
630+
if ($parameterBag instanceof EnvPlaceholderParameterBag && $otherBag instanceof EnvPlaceholderParameterBag) {
631+
$envPlaceholders = $otherBag->getEnvPlaceholders();
632+
$parameterBag->mergeEnvPlaceholders($otherBag);
627633
} else {
628634
$envPlaceholders = [];
629635
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy