bug #25559 [Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions (nicolas-grekas)
This PR was merged into the 3.3 branch.
Discussion
----------
[Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions
| Q | A
| ------------- | ---
| Branch? | 3.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #25511
| License | MIT
| Doc PR | -
Commits
-------
0d4bce6
[Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions
This commit is contained in:
commit
6935e5a4aa
@ -1718,15 +1718,11 @@ class Process implements \IteratorAggregate
|
|||||||
|
|
||||||
private function getDefaultEnv()
|
private function getDefaultEnv()
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID >= 70100) {
|
$env = array();
|
||||||
$env = getenv();
|
|
||||||
} else {
|
|
||||||
$env = array();
|
|
||||||
|
|
||||||
foreach ($_SERVER as $k => $v) {
|
foreach ($_SERVER as $k => $v) {
|
||||||
if (is_string($v) && false !== $v = getenv($k)) {
|
if (is_string($v) && false !== $v = getenv($k)) {
|
||||||
$env[$k] = $v;
|
$env[$k] = $v;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user