Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 77f8f52

Browse files
[Process] intersect with getenv() to populate default envs
1 parent 94ff309 commit 77f8f52

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,13 +1671,8 @@ private function replacePlaceholders(string $commandline, array $env)
16711671

16721672
private function getDefaultEnv(): array
16731673
{
1674-
$env = [];
1675-
1676-
foreach ($_SERVER as $k => $v) {
1677-
if (\is_string($v) && false !== $v = getenv($k)) {
1678-
$env[$k] = $v;
1679-
}
1680-
}
1674+
$env = getenv();
1675+
$env = array_intersect_key($env, $_SERVER) ?: $env;
16811676

16821677
foreach ($_ENV as $k => $v) {
16831678
if (\is_string($v)) {

0 commit comments

Comments
 (0)