Skip to content

Commit 746e751

Browse files
Merge branch '3.4' into 4.3
* 3.4: [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
2 parents 0a012e0 + 39c36d1 commit 746e751

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
@@ -458,7 +458,7 @@ private function resolveVariables($value, array $loadedVars)
458458
} elseif (isset($this->values[$name])) {
459459
$value = $this->values[$name];
460460
} else {
461-
$value = '';
461+
$value = (string) getenv($name);
462462
}
463463

464464
if (!$matches['opening_brace'] && isset($matches['closing_brace'])) {

Tests/DotenvTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,17 @@ public function testGetVariablesValueFromEnvFirst()
431431
}
432432
}
433433

434+
public function testGetVariablesValueFromGetenv()
435+
{
436+
putenv('Foo=Bar');
437+
438+
$dotenv = new Dotenv(true);
439+
$values = $dotenv->parse('Foo=${Foo}');
440+
$this->assertSame('Bar', $values['Foo']);
441+
442+
putenv('Foo');
443+
}
444+
434445
/**
435446
* @group legacy
436447
* @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)