From 2c39c43a9e9c0ebf8b0477adcfdafc26b94116d7 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 30 Dec 2016 12:43:11 +0100 Subject: [PATCH 1/2] Forward memory limit even if it was overwritten when restarting without xdebug, fixes #6004 --- src/Composer/XdebugHandler.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Composer/XdebugHandler.php b/src/Composer/XdebugHandler.php index 35581acf6..7a793d537 100644 --- a/src/Composer/XdebugHandler.php +++ b/src/Composer/XdebugHandler.php @@ -171,6 +171,8 @@ class XdebugHandler $content .= $this->getIniData($file, $replace); } + $content .= PHP_EOL.'memory_limit='.ini_get('memory_limit').PHP_EOL; + return @file_put_contents($this->tmpIni, $content); } From e1612188194ad7f198494716c5e1fab3782a341e Mon Sep 17 00:00:00 2001 From: Alex Bowers Date: Thu, 29 Dec 2016 12:08:18 +0000 Subject: [PATCH 2/2] Refactored xdebughandler --- src/Composer/XdebugHandler.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Composer/XdebugHandler.php b/src/Composer/XdebugHandler.php index 7a793d537..be04dec55 100644 --- a/src/Composer/XdebugHandler.php +++ b/src/Composer/XdebugHandler.php @@ -63,7 +63,10 @@ class XdebugHandler $args = explode('|', strval(getenv(self::ENV_ALLOW)), 2); if ($this->needsRestart($args[0])) { - $this->prepareRestart($command) && $this->restart($command); + if ($this->prepareRestart()) { + $command = $this->getCommand(); + $this->restart($command); + } return; } @@ -127,18 +130,15 @@ class XdebugHandler * - tmp ini file creation * - environment variable creation * - * @param null|string $command The command to run, set by method - * * @return bool */ - private function prepareRestart(&$command) + private function prepareRestart() { $this->tmpIni = ''; $iniPaths = IniHelper::getAll(); $files = $this->getWorkingSet($iniPaths, $replace); if ($this->writeTmpIni($files, $replace)) { - $command = $this->getCommand(); return $this->setEnvironment($iniPaths); }