Revert "bug #29409 Fix env fallback to an unresolved variable (jderusse)"
This reverts commitab95ae3f7a
, reversing changes made to8a6090793b
.
This commit is contained in:
parent
5dd8a0ca98
commit
64e2449f8e
@ -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)"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user