From c88bc899d44d144bddbcfd5e7208fc06e81f518b Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Tue, 13 Dec 2016 19:24:48 +0100 Subject: [PATCH] Fix misresolved parameters in debug:config on 3.2 --- .../FrameworkBundle/Command/ConfigDebugCommand.php | 6 +++--- .../Tests/Functional/ConfigDebugCommandTest.php | 10 ++++++++++ .../Tests/Functional/app/ConfigDump/config.yml | 8 ++++++++ src/Symfony/Bundle/FrameworkBundle/composer.json | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php index 33073b0a91044..921dba0dde977 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $configs = $container->resolveEnvPlaceholders($container->getParameterBag()->resolveValue($configs)); $processor = new Processor(); - $config = $processor->processConfiguration($configuration, $configs); + $config = $container->resolveEnvPlaceholders($container->getParameterBag()->resolveValue($processor->processConfiguration($configuration, $configs))); if (null === $path = $input->getArgument('path')) { $io->title( @@ -105,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path)); - $io->writeln(Yaml::dump($container->getParameterBag()->resolveValue($config), 10)); + $io->writeln(Yaml::dump($config, 10)); } private function compileContainer() @@ -130,7 +130,7 @@ private function compileContainer() * * @return mixed */ - private function getConfigForPath(array $config = array(), $path, $alias) + private function getConfigForPath(array $config, $path, $alias) { $steps = explode('.', $path); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php index 0305d65f6f3c5..5b40325e08eb9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php @@ -48,6 +48,16 @@ public function testDumpBundleOption() $this->assertContains('foo', $tester->getDisplay()); } + public function testParametersValuesAreResolved() + { + $tester = $this->createCommandTester(); + $ret = $tester->execute(array('name' => 'framework')); + + $this->assertSame(0, $ret, 'Returns 0 in case of success'); + $this->assertContains("locale: '%env(LOCALE)%'", $tester->getDisplay()); + $this->assertContains('secret: test', $tester->getDisplay()); + } + public function testDumpUndefinedBundleOption() { $tester = $this->createCommandTester(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/ConfigDump/config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/ConfigDump/config.yml index 377d3e7852064..c1d1288046050 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/ConfigDump/config.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/ConfigDump/config.yml @@ -1,2 +1,10 @@ imports: - { resource: ../config/default.yml } + +framework: + secret: '%secret%' + default_locale: '%env(LOCALE)%' + +parameters: + env(LOCALE): en + secret: test diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 278fadaf98d10..7f608d6fd73c7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -19,7 +19,7 @@ "php": ">=5.5.9", "symfony/cache": "~3.2", "symfony/class-loader": "~3.2", - "symfony/dependency-injection": "~3.2", + "symfony/dependency-injection": "~3.2.1|~3.3", "symfony/config": "~2.8|~3.0", "symfony/event-dispatcher": "~2.8|~3.0", "symfony/http-foundation": "~3.1",