[Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions

This commit is contained in:
Nicolas Grekas 2017-12-20 12:18:49 +01:00
parent d731a2748f
commit 0d4bce6676

View File

@ -1718,15 +1718,11 @@ class Process implements \IteratorAggregate
private function getDefaultEnv()
{
if (\PHP_VERSION_ID >= 70100) {
$env = getenv();
} else {
$env = array();
$env = array();
foreach ($_SERVER as $k => $v) {
if (is_string($v) && false !== $v = getenv($k)) {
$env[$k] = $v;
}
foreach ($_SERVER as $k => $v) {
if (is_string($v) && false !== $v = getenv($k)) {
$env[$k] = $v;
}
}