From b056d9ae4231a5b348f2133929092caa2e9abb99 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 10 Jan 2016 12:43:48 +0000 Subject: [PATCH] Avoid double xdebug warning with global command --- src/Composer/Console/Application.php | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index 7d25b6c18..1156f28a0 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -107,26 +107,26 @@ class Application extends BaseApplication ErrorHandler::register($this->io); $io = $this->getIO(); - if (PHP_VERSION_ID < 50302) { - $io->writeError('Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.'); + // determine command name to be executed + $commandName = ''; + if ($name = $this->getCommandName($input)) { + try { + $commandName = $this->find($name)->getName(); + } catch (\InvalidArgumentException $e) { + } } - if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) { - $io->writeError('You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug'); - } + if ($commandName !== 'global') { + if (PHP_VERSION_ID < 50302) { + $io->writeError('Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.'); + } - if (defined('COMPOSER_DEV_WARNING_TIME')) { - $commandName = ''; - if ($name = $this->getCommandName($input)) { - try { - $commandName = $this->find($name)->getName(); - } catch (\InvalidArgumentException $e) { - } + if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) { + $io->writeError('You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug'); } - if ($commandName !== 'self-update' && $commandName !== 'selfupdate') { - if (time() > COMPOSER_DEV_WARNING_TIME) { - $io->writeError(sprintf('Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.', $_SERVER['PHP_SELF'])); - } + + if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) { + $io->writeError(sprintf('Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.', $_SERVER['PHP_SELF'])); } }