diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php index 00f27bb7b3cdd..2e907b8c980b8 100644 --- a/src/Symfony/Component/Dotenv/Dotenv.php +++ b/src/Symfony/Component/Dotenv/Dotenv.php @@ -351,7 +351,7 @@ private function resolveVariables($value) } $name = $matches[3]; - $value = isset($this->values[$name]) ? $this->values[$name] : (isset($_ENV[$name]) ? isset($_ENV[$name]) : (string) getenv($name)); + $value = isset($this->values[$name]) ? $this->values[$name] : (isset($_ENV[$name]) ? $_ENV[$name] : (string) getenv($name)); if (!$matches[2] && isset($matches[4])) { $value .= '}'; diff --git a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php index a7f211ecd6e37..47598030a87f1 100644 --- a/src/Symfony/Component/Dotenv/Tests/DotenvTest.php +++ b/src/Symfony/Component/Dotenv/Tests/DotenvTest.php @@ -63,6 +63,7 @@ public function testParse($data, $expected) public function getEnvData() { putenv('LOCAL=local'); + $_ENV['REMOTE'] = 'remote'; $tests = array( // spaces @@ -134,6 +135,7 @@ public function getEnvData() array('FOO=" \\$ "', array('FOO' => ' $ ')), array('FOO=" $ "', array('FOO' => ' $ ')), array('BAR=$LOCAL', array('BAR' => 'local')), + array('BAR=$REMOTE', array('BAR' => 'remote')), array('FOO=$NOTDEFINED', array('FOO' => '')), );