1
0
Fork 0

Fix env override regression, fixes #3820

pull/3825/head
Jordi Boggiano 2015-03-06 16:20:27 +00:00
parent dfd04a9458
commit b80038804f
7 changed files with 16 additions and 6 deletions

View File

@ -316,7 +316,8 @@ EOT
$io->writeError('<info>Created project in ' . $directory . '</info>'); $io->writeError('<info>Created project in ' . $directory . '</info>');
chdir($directory); chdir($directory);
putenv('COMPOSER_ROOT_VERSION='.$package->getPrettyVersion()); $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
return $installedFromVcs; return $installedFromVcs;
} }

View File

@ -87,7 +87,8 @@ EOT
// add the bin dir to the PATH to make local binaries of deps usable in scripts // add the bin dir to the PATH to make local binaries of deps usable in scripts
$binDir = $composer->getConfig()->get('bin-dir'); $binDir = $composer->getConfig()->get('bin-dir');
if (is_dir($binDir)) { if (is_dir($binDir)) {
putenv('PATH='.realpath($binDir).PATH_SEPARATOR.getenv('PATH')); $_SERVER['PATH'] = realpath($binDir).PATH_SEPARATOR.getenv('PATH');
putenv('PATH='.$_SERVER['PATH']);
} }
$args = $input->getArgument('args'); $args = $input->getArgument('args');

View File

@ -57,7 +57,8 @@ EOT
// add the bin dir to the PATH to make local binaries of deps usable in scripts // add the bin dir to the PATH to make local binaries of deps usable in scripts
$binDir = $composer->getConfig()->get('bin-dir'); $binDir = $composer->getConfig()->get('bin-dir');
if (is_dir($binDir)) { if (is_dir($binDir)) {
putenv('PATH='.realpath($binDir).PATH_SEPARATOR.getenv('PATH')); $_SERVER['PATH'] = realpath($binDir).PATH_SEPARATOR.getenv('PATH');
putenv('PATH='.$_SERVER['PATH']);
} }
$args = $input->getArguments(); $args = $input->getArguments();

View File

@ -164,18 +164,22 @@ class Git
// added in git 1.7.1, prevents prompting the user for username/password // added in git 1.7.1, prevents prompting the user for username/password
if (getenv('GIT_ASKPASS') !== 'echo') { if (getenv('GIT_ASKPASS') !== 'echo') {
putenv('GIT_ASKPASS=echo'); putenv('GIT_ASKPASS=echo');
unset($_SERVER['GIT_ASKPASS']);
} }
// clean up rogue git env vars in case this is running in a git hook // clean up rogue git env vars in case this is running in a git hook
if (getenv('GIT_DIR')) { if (getenv('GIT_DIR')) {
putenv('GIT_DIR'); putenv('GIT_DIR');
unset($_SERVER['GIT_DIR']);
} }
if (getenv('GIT_WORK_TREE')) { if (getenv('GIT_WORK_TREE')) {
putenv('GIT_WORK_TREE'); putenv('GIT_WORK_TREE');
unset($_SERVER['GIT_WORK_TREE']);
} }
// clean up env for OSX, see https://github.com/composer/composer/issues/2146#issuecomment-35478940 // clean up env for OSX, see https://github.com/composer/composer/issues/2146#issuecomment-35478940
putenv("DYLD_LIBRARY_PATH"); putenv("DYLD_LIBRARY_PATH");
unset($_SERVER['DYLD_LIBRARY_PATH']);
} }
public static function getGitHubDomainsRegex(Config $config) public static function getGitHubDomainsRegex(Config $config)

View File

@ -56,7 +56,7 @@ class ProcessExecutor
$this->captureOutput = count(func_get_args()) > 1; $this->captureOutput = count(func_get_args()) > 1;
$this->errorOutput = null; $this->errorOutput = null;
$process = new Process($command, $cwd, array('LANGUAGE' => 'C') + $_ENV + $_SERVER, null, static::getTimeout()); $process = new Process($command, $cwd, array_replace($_ENV, $_SERVER, array('LANGUAGE' => 'C')), null, static::getTimeout());
$callback = is_callable($output) ? $output : array($this, 'outputHandler'); $callback = is_callable($output) ? $output : array($this, 'outputHandler');
$process->run($callback); $process->run($callback);

View File

@ -81,6 +81,7 @@ class Svn
{ {
// clean up env for OSX, see https://github.com/composer/composer/issues/2146#issuecomment-35478940 // clean up env for OSX, see https://github.com/composer/composer/issues/2146#issuecomment-35478940
putenv("DYLD_LIBRARY_PATH"); putenv("DYLD_LIBRARY_PATH");
unset($_SERVER['DYLD_LIBRARY_PATH']);
} }
/** /**

View File

@ -42,7 +42,8 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase
} }
if ($this->oldenv) { if ($this->oldenv) {
$fs->removeDirectory(getenv('COMPOSER_HOME')); $fs->removeDirectory(getenv('COMPOSER_HOME'));
putenv('COMPOSER_HOME='.$this->oldenv); $_SERVER['COMPOSER_HOME'] = $this->oldenv;
putenv('COMPOSER_HOME='.$_SERVER['COMPOSER_HOME']);
$this->oldenv = null; $this->oldenv = null;
} }
} }
@ -86,7 +87,8 @@ class AllFunctionalTest extends \PHPUnit_Framework_TestCase
$testData = $this->parseTestFile($testFile); $testData = $this->parseTestFile($testFile);
$this->oldenv = getenv('COMPOSER_HOME'); $this->oldenv = getenv('COMPOSER_HOME');
putenv('COMPOSER_HOME='.$this->testDir.'home'); $_SERVER['COMPOSER_HOME'] = $this->testDir.'home';
putenv('COMPOSER_HOME='.$_SERVER['COMPOSER_HOME']);
$cmd = 'php '.escapeshellarg(self::$pharPath).' --no-ansi '.$testData['RUN']; $cmd = 'php '.escapeshellarg(self::$pharPath).' --no-ansi '.$testData['RUN'];
$proc = new Process($cmd, __DIR__.'/Fixtures/functional', null, null, 300); $proc = new Process($cmd, __DIR__.'/Fixtures/functional', null, null, 300);