Workaround PHP bug properly as getenv() without arg also returns mangled values, fixes #10434
parent
9305dea128
commit
d9619985db
|
@ -68,7 +68,11 @@ if (function_exists('ini_set')) {
|
||||||
// Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER
|
// Workaround PHP bug on Windows where env vars containing Unicode chars are mangled in $_SERVER
|
||||||
// see https://github.com/php/php-src/issues/7896
|
// see https://github.com/php/php-src/issues/7896
|
||||||
if (PHP_VERSION_ID >= 70113 && Platform::isWindows()) {
|
if (PHP_VERSION_ID >= 70113 && Platform::isWindows()) {
|
||||||
$_SERVER = array_merge($_SERVER, array_intersect_ukey($_SERVER, getenv(), 'strcasecmp'));
|
foreach ($_SERVER as $serverVar => $serverVal) {
|
||||||
|
if (($serverVal = getenv($serverVar)) !== false) {
|
||||||
|
$_SERVER[$serverVar] = $serverVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform::putEnv('COMPOSER_BINARY', realpath($_SERVER['argv'][0]));
|
Platform::putEnv('COMPOSER_BINARY', realpath($_SERVER['argv'][0]));
|
||||||
|
|
Loading…
Reference in New Issue