Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b38aad5

Browse filesBrowse files
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 ------- 9c5754a [Dotenv] FIX missing getenv
2 parents e85acdd + 9c5754a commit b38aad5
Copy full SHA for b38aad5

File tree

2 files changed

+12
-1
lines changed
Filter options

2 files changed

+12
-1
lines changed

‎src/Symfony/Component/Dotenv/Dotenv.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Dotenv/Dotenv.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ private function resolveVariables($value, array $loadedVars)
387387
} elseif (isset($this->values[$name])) {
388388
$value = $this->values[$name];
389389
} else {
390-
$value = '';
390+
$value = (string) getenv($name);
391391
}
392392

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

‎src/Symfony/Component/Dotenv/Tests/DotenvTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Dotenv/Tests/DotenvTest.php
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,15 @@ public function testGetVariablesValueFromEnvFirst()
314314
$this->assertSame('foo2_prod', $values['TEST2']);
315315
}
316316
}
317+
318+
public function testGetVariablesValueFromGetenv()
319+
{
320+
putenv('Foo=Bar');
321+
322+
$dotenv = new Dotenv(true);
323+
$values = $dotenv->parse('Foo=${Foo}');
324+
$this->assertSame('Bar', $values['Foo']);
325+
326+
putenv('Foo');
327+
}
317328
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.