1
0
Fork 0

Make sure $_SERVER is updated when putenv updates environment variables, fixes #8298

pull/8661/head
Jordi Boggiano 2020-02-28 16:27:06 +01:00
parent 7a270955f5
commit c6969756e8
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 6 additions and 4 deletions

View File

@ -131,7 +131,8 @@ class Application extends BaseApplication
if ($input->hasParameterOption('--no-cache')) { if ($input->hasParameterOption('--no-cache')) {
$io->writeError('Disabling cache usage', true, IOInterface::DEBUG); $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
putenv('COMPOSER_CACHE_DIR='.(Platform::isWindows() ? 'nul' : '/dev/null')); $_SERVER['COMPOSER_CACHE_DIR'] = Platform::isWindows() ? 'nul' : '/dev/null';
putenv('COMPOSER_CACHE_DIR='.$_SERVER['COMPOSER_CACHE_DIR']);
} }
// switch working dir // switch working dir

View File

@ -242,7 +242,8 @@ class EventDispatcher
$finder = new PhpExecutableFinder(); $finder = new PhpExecutableFinder();
$phpPath = $finder->find(false); $phpPath = $finder->find(false);
if ($phpPath) { if ($phpPath) {
putenv('PHP_BINARY=' . $phpPath); $_SERVER['PHP_BINARY'] = $phpPath;
putenv('PHP_BINARY=' . $_SERVER['PHP_BINARY']);
} }
} }

View File

@ -200,8 +200,8 @@ class Installer
} }
if ($this->runScripts) { if ($this->runScripts) {
$devMode = (int) $this->devMode; $_SERVER['COMPOSER_DEV_MODE'] = (int) $this->devMode;
putenv("COMPOSER_DEV_MODE=$devMode"); putenv('COMPOSER_DEV_MODE='.$_SERVER['COMPOSER_DEV_MODE']);
// dispatch pre event // dispatch pre event
$eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD; $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;