1
0
Fork 0

Merge remote-tracking branch 'alcohol/fix-5667'

pull/5669/head
Jordi Boggiano 2016-09-12 16:57:13 +02:00
commit be727a7a6b
1 changed files with 18 additions and 1 deletions

View File

@ -20,6 +20,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class XdebugHandler
{
const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
const ENV_INI_SCAN_DIR = 'PHP_INI_SCAN_DIR';
const ENV_INI_SCAN_DIR_OLD = 'COMPOSER_PHP_INI_SCAN_DIR_OLD';
private $output;
private $loaded;
@ -49,6 +51,15 @@ class XdebugHandler
public function check()
{
if (!$this->needsRestart()) {
$originalIniScanDir = getenv(self::ENV_INI_SCAN_DIR_OLD);
if ($originalIniScanDir) {
putenv(self::ENV_INI_SCAN_DIR_OLD);
putenv(self::ENV_INI_SCAN_DIR.'=' . $originalIniScanDir);
} else {
putenv(self::ENV_INI_SCAN_DIR);
}
return;
}
@ -204,7 +215,13 @@ class XdebugHandler
if (!file_exists($this->scanDir) && !@mkdir($this->scanDir, 0777)) {
return;
}
if (!putenv('PHP_INI_SCAN_DIR='.$this->scanDir)) {
$currentIniScanDir = getenv(self::ENV_INI_SCAN_DIR);
if ($currentIniScanDir) {
putenv(self::ENV_INI_SCAN_DIR_OLD.'='.$currentIniScanDir);
}
if (!putenv(self::ENV_INI_SCAN_DIR.'='.$this->scanDir)) {
return;
}
}