diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index cdcea02ed1..52a9f8aca8 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1430,6 +1430,9 @@ EOF; private function dumpValue($value, $interpolate = true) { if (is_array($value)) { + if ($value && $interpolate && false !== $param = array_search($value, $this->container->getParameterBag()->all(), true)) { + return $this->dumpValue("%$param%"); + } $code = array(); foreach ($value as $k => $v) { $code[] = sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate)); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index fc5a950af4..e60ee91cdd 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -607,7 +607,7 @@ class PhpDumperTest extends TestCase $container->setParameter('array_1', array(123)); $container->setParameter('array_2', array(__DIR__)); $container->register('bar', 'BarClass') - ->addMethodCall('setBaz', array('%array_1%', '%array_2%', '%%array_1%%')); + ->addMethodCall('setBaz', array('%array_1%', '%array_2%', '%%array_1%%', array(123))); $container->compile(); $dumper = new PhpDumper($container); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php index 92db92cc4e..b8d52d69f5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services_array_params.php @@ -75,7 +75,7 @@ class ProjectServiceContainer extends Container { $this->services['bar'] = $instance = new \BarClass(); - $instance->setBaz($this->parameters['array_1'], $this->getParameter('array_2'), '%array_1%'); + $instance->setBaz($this->parameters['array_1'], $this->getParameter('array_2'), '%array_1%', $this->parameters['array_1']); return $instance; }