bug #35022 [Dotenv] FIX missing getenv (mccullagh)
This PR was merged into the 3.4 branch.
Discussion
----------
[Dotenv] FIX missing getenv
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no>
| Tickets | Fix #34598
| License | MIT
| Doc PR | -
Revert one line to use getenv because not all environment variables are populated in $_ENV[]
Commits
-------
9c5754acaa
[Dotenv] FIX missing getenv
This commit is contained in:
commit
b38aad5a39
@ -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'])) {
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user