Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5f1b505

Browse files
committed
Fix misresolved parameters in debug:config on 3.2
1 parent 5f0f842 commit 5f1b505

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Console\Style\SymfonyStyle;
1919
use Symfony\Component\Console\Exception\LogicException;
2020
use Symfony\Component\Yaml\Yaml;
21+
use Symfony\Component\DependencyInjection\ContainerBuilder;
2122

2223
/**
2324
* A console command for dumping available configuration reference.
@@ -83,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8384
$configs = $container->resolveEnvPlaceholders($container->getParameterBag()->resolveValue($configs));
8485

8586
$processor = new Processor();
86-
$config = $processor->processConfiguration($configuration, $configs);
87+
$config = $container->resolveEnvPlaceholders($container->getParameterBag()->resolveValue($processor->processConfiguration($configuration, $configs)));
8788

8889
if (null === $path = $input->getArgument('path')) {
8990
$io->title(
@@ -105,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
105106

106107
$io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path));
107108

108-
$io->writeln(Yaml::dump($container->getParameterBag()->resolveValue($config), 10));
109+
$io->writeln(Yaml::dump($config, 10));
109110
}
110111

111112
private function compileContainer()
@@ -130,7 +131,7 @@ private function compileContainer()
130131
*
131132
* @return mixed
132133
*/
133-
private function getConfigForPath(array $config = array(), $path, $alias)
134+
private function getConfigForPath(array $config, $path, $alias)
134135
{
135136
$steps = explode('.', $path);
136137

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ConfigDebugCommandTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ public function testDumpBundleOption()
4848
$this->assertContains('foo', $tester->getDisplay());
4949
}
5050

51+
public function testParametersValuesAreResolved()
52+
{
53+
$tester = $this->createCommandTester();
54+
$ret = $tester->execute(array('name' => 'framework'));
55+
56+
$this->assertSame(0, $ret, 'Returns 0 in case of success');
57+
$this->assertContains("locale: '%env(LOCALE)%'", $tester->getDisplay());
58+
$this->assertContains('secret: test', $tester->getDisplay());
59+
}
60+
5161
public function testDumpUndefinedBundleOption()
5262
{
5363
$tester = $this->createCommandTester();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
imports:
22
- { resource: ../config/default.yml }
3+
4+
framework:
5+
secret: '%secret%'
6+
default_locale: '%env(LOCALE)%'
7+
8+
parameters:
9+
env(LOCALE): en
10+
secret: test

0 commit comments

Comments
 (0)