diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php
index 578d62cf3..6757149cc 100644
--- a/src/Composer/Console/Application.php
+++ b/src/Composer/Console/Application.php
@@ -57,7 +57,7 @@ class Application extends BaseApplication
public function __construct()
{
static $shutdownRegistered = false;
-
+
if (function_exists('ini_set') && extension_loaded('xdebug')) {
ini_set('xdebug.show_exception_trace', false);
ini_set('xdebug.scream', false);
@@ -66,13 +66,13 @@ class Application extends BaseApplication
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
date_default_timezone_set(@date_default_timezone_get());
}
-
+
if (!$shutdownRegistered) {
$shutdownRegistered = true;
-
+
register_shutdown_function(function() {
$lastError = error_get_last();
-
+
if ($lastError && $lastError['message'] &&
(strpos($lastError['message'], 'Allowed memory') !== false /*Zend PHP out of memory error*/ ||
strpos($lastError['message'], 'exceeded memory') !== false /*HHVM out of memory errors*/)) {
@@ -110,10 +110,10 @@ class Application extends BaseApplication
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 (extension_loaded('xdebug')) {
- $io->write('You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug');
- }
+ $io->writeError('You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug');
+ }
if (defined('COMPOSER_DEV_WARNING_TIME')) {
$commandName = '';
diff --git a/tests/Composer/Test/ApplicationTest.php b/tests/Composer/Test/ApplicationTest.php
index 58a02ef4f..68d17d3f6 100644
--- a/tests/Composer/Test/ApplicationTest.php
+++ b/tests/Composer/Test/ApplicationTest.php
@@ -28,7 +28,14 @@ class ApplicationTest extends TestCase
->method('getFirstArgument')
->will($this->returnValue('list'));
- $outputMock->expects($this->once())
+ $index = 0;
+ if (extension_loaded('xdebug')) {
+ $outputMock->expects($this->at($index++))
+ ->method("write")
+ ->with($this->equalTo('You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug'));
+ }
+
+ $outputMock->expects($this->at($index++))
->method("write")
->with($this->equalTo(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'])));