8000 [DotEnv] Fix variable substitution · symfony/dotenv@0bbd618 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0bbd618

Browse files
committed
[DotEnv] Fix variable substitution
1 parent f6e82cd commit 0bbd618

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Dotenv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ private function resolveVariables($value)
351351
}
352352

353353
$name = $matches[3];
354-
$value = isset($this->values[$name]) ? $this->values[$name] : (isset($_ENV[$name]) ? isset($_ENV[$name]) : (string) getenv($name));
354+
$value = isset($this->values[$name]) ? $this->values[$name] : (isset($_ENV[$name]) ? $_ENV[$name] : (string) getenv($name));
355355

356356
if (!$matches[2] && isset($matches[4])) {
357357
$value .= '}';

Tests/DotenvTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function testParse($data, $expected)
6363
public function getEnvData()
6464
{
6565
putenv('LOCAL=local');
66+
$_ENV['REMOTE'] = 'remote';
6667

6768
$tests = array(
6869
// spaces
@@ -134,6 +135,7 @@ public function getEnvData()
134135
array('FOO=" \\$ "', array('FOO' => ' $ ')),
135136
array('FOO=" $ "', array('FOO' => ' $ ')),
136137
array('BAR=$LOCAL', array('BAR' => 'local')),
138+
array('BAR=$REMOTE', array('BAR' => 'remote')),
137139
array('FOO=$NOTDEFINED', array('FOO' => '')),
138140
);
139141

0 commit comments

Comments
 (0)
0