Skip to content

Commit c387ab3

Browse files
Merge branch '4.3' into 4.4
* 4.3: [ProxyManager] fix generating proxies for root-namespaced classes [DI] skip looking for config class when the extension class is anonymous Fix typo [Dotenv] FIX missing getenv [HttpClient][Psr18Client] Remove Psr18ExceptionTrait
2 parents bb9ee27 + 746e751 commit c387ab3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Dotenv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ private function resolveVariables(string $value, array $loadedVars): string
463463
} elseif (isset($this->values[$name])) {
464464
$value = $this->values[$name];
465465
} else {
466-
$value = '';
466+
$value = (string) getenv($name);
467467
}
468468

469469
if ('' === $value && isset($matches['default_value']) && '' !== $matches['default_value']) {

Tests/DotenvTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,17 @@ public function testGetVariablesValueFromEnvFirst()
443443
}
444444
}
445445

446+
public function testGetVariablesValueFromGetenv()
447+
{
448+
putenv('Foo=Bar');
449+
450+
$dotenv = new Dotenv(true);
451+
$values = $dotenv->parse('Foo=${Foo}');
452+
$this->assertSame('Bar', $values['Foo']);
453+
454+
putenv('Foo');
455+
}
456+
446457
/**
447458
* @group legacy
448459
* @expectedDeprecation The default value of "$usePutenv" argument of "%s" will be changed from "true" to "false" in Symfony 5.0. You should define its value explicitly.

0 commit comments

Comments
 (0)