[Dotenv] FIX missing getenv

This commit is contained in:
Alexander McCullagh 2019-12-18 15:26:27 +01:00
parent e85acddc9a
commit 9c5754acaa
2 changed files with 12 additions and 1 deletions

View File

@ -387,7 +387,7 @@ final class Dotenv
} elseif (isset($this->values[$name])) {
$value = $this->values[$name];
} else {
$value = '';
$value = (string) getenv($name);
}
if (!$matches['opening_brace'] && isset($matches['closing_brace'])) {

View File

@ -314,4 +314,15 @@ class DotenvTest extends TestCase
$this->assertSame('foo2_prod', $values['TEST2']);
}
}
public function testGetVariablesValueFromGetenv()
{
putenv('Foo=Bar');
$dotenv = new Dotenv(true);
$values = $dotenv->parse('Foo=${Foo}');
$this->assertSame('Bar', $values['Foo']);
putenv('Foo');
}
}