diff --git a/CHANGELOG-3.3.md b/CHANGELOG-3.3.md index 185d1432cc409..3331ea2a1d1fa 100644 --- a/CHANGELOG-3.3.md +++ b/CHANGELOG-3.3.md @@ -7,6 +7,10 @@ in 3.3 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.3.0...v3.3.1 +* 3.3.8 (2017-08-28) + + * bug #24016 [DI] Fix tracking env var placeholders nested in object graphs (nicolas-grekas) + * 3.3.7 (2017-08-28) * bug #24009 [DI] Fix tracking env vars when merging configs (bis) (nicolas-grekas) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php index 3e4acf5664e76..853b1fd05e96e 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php @@ -95,7 +95,18 @@ public function __construct(parent $parameterBag) public function freezeAfterProcessing(Extension $extension) { $this->processedEnvPlaceholders = array(); - $this->processMergedConfig($extension->getProcessedConfigs(), parent::getEnvPlaceholders()); + + // serialize config to catch env vars nested in object graphs + $config = serialize($extension->getProcessedConfigs()); + + foreach (parent::getEnvPlaceholders() as $env => $placeholders) { + foreach ($placeholders as $placeholder) { + if (false !== stripos($config, $placeholder)) { + $this->processedEnvPlaceholders[$env] = $placeholders; + break; + } + } + } } /** @@ -105,25 +116,4 @@ public function getEnvPlaceholders() { return null !== $this->processedEnvPlaceholders ? $this->processedEnvPlaceholders : parent::getEnvPlaceholders(); } - - private function processMergedConfig($value, array $envPlaceholders) - { - if (is_array($value)) { - foreach ($value as $k => $v) { - $this->processMergedConfig($k, $envPlaceholders); - $this->processMergedConfig($v, $envPlaceholders); - } - } elseif (is_string($value)) { - foreach ($envPlaceholders as $env => $placeholders) { - foreach ($placeholders as $placeholder) { - if (false !== stripos($value, $placeholder)) { - $this->processedEnvPlaceholders[$env] = $placeholders; - break; - } - } - } - } - - return $value; - } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index 033e6c00fc342..44d1933a80fa8 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -81,7 +81,7 @@ public function testOverriddenEnvsAreMerged() $pass = new MergeExtensionConfigurationPass(); $pass->process($container); - $this->assertSame(array('FOO', 'BAZ'), array_keys($container->getParameterBag()->getEnvPlaceholders())); + $this->assertSame(array('BAZ', 'FOO'), array_keys($container->getParameterBag()->getEnvPlaceholders())); $this->assertSame(array('BAZ' => 1, 'FOO' => 0), $container->getEnvCounters()); } } diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 815841ec6c84f..0fa9dbd5451b6 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -61,11 +61,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface private $projectDir; - const VERSION = '3.3.7'; - const VERSION_ID = 30307; + const VERSION = '3.3.8'; + const VERSION_ID = 30308; const MAJOR_VERSION = 3; const MINOR_VERSION = 3; - const RELEASE_VERSION = 7; + const RELEASE_VERSION = 8; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '01/2018';