Revert "bug #29409 Fix env fallback to an unresolved variable (jderusse)"

This reverts commit ab95ae3f7a, reversing
changes made to 8a6090793b.
This commit is contained in:
Nicolas Grekas 2018-12-17 15:44:10 +01:00
parent 5dd8a0ca98
commit 64e2449f8e
2 changed files with 4 additions and 22 deletions

View File

@ -1534,15 +1534,11 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
return $value;
}
$envPlaceholders = $bag->getEnvPlaceholders();
if (isset($envPlaceholders[$name][$value])) {
$bag = new ParameterBag($bag->all());
return $bag->unescapeValue($bag->get("env($name)"));
}
foreach ($envPlaceholders as $env => $placeholders) {
foreach ($bag->getEnvPlaceholders() as $env => $placeholders) {
if (isset($placeholders[$value])) {
return $this->getEnv($env);
$bag = new ParameterBag($bag->all());
return $bag->unescapeValue($bag->get("env($name)"));
}
}

View File

@ -738,20 +738,6 @@ class ContainerBuilderTest extends TestCase
$this->assertSame('someFooBar', $container->getParameter('baz'));
}
public function testFallbackEnv()
{
putenv('DUMMY_FOO=foo');
$container = new ContainerBuilder();
$container->setParameter('foo', '%env(DUMMY_FOO)%');
$container->setParameter('bar', 'bar%env(default:foo:DUMMY_BAR)%');
$container->compile(true);
putenv('DUMMY_FOO');
$this->assertSame('barfoo', $container->getParameter('bar'));
}
public function testCastEnv()
{
$container = new ContainerBuilder();