From 7a06615bf06c5a391ab2d360907012529508e695 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 21 Nov 2015 20:06:31 +0000 Subject: [PATCH] Add env var to disable xdebug warnings, refs #4622 --- doc/03-cli.md | 4 ++++ doc/articles/troubleshooting.md | 3 +++ src/Composer/Console/Application.php | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/03-cli.md b/doc/03-cli.md index b7a908f3d..2a8f5e9d9 100644 --- a/doc/03-cli.md +++ b/doc/03-cli.md @@ -693,4 +693,8 @@ This env var controls the [`discard-changes`](06-config.md#discard-changes) conf If set to 1, this env var will make Composer behave as if you passed the `--no-interaction` flag to every command. This can be set on build boxes/CI. +### COMPOSER_DISABLE_XDEBUG_WARN + +If set to 1, this env disables the warning about having xdebug enabled. + ← [Libraries](02-libraries.md) | [Schema](04-schema.md) → diff --git a/doc/articles/troubleshooting.md b/doc/articles/troubleshooting.md index c61385681..9fc96db0c 100644 --- a/doc/articles/troubleshooting.md +++ b/doc/articles/troubleshooting.md @@ -146,6 +146,9 @@ locating the related `zend_extension` directive and prepending it with `;` (semi ;zend_extension = "/path/to/my/xdebug.so" ``` +If you do not want to disable it and want to get rid of the warning you can also define the +[COMPOSER_DISABLE_XDEBUG_WARN](../03-cli.md#composer-disable-xdebug-warn) environment variable. + ## "The system cannot find the path specified" (Windows) 1. Open regedit. diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index e330ed3ce..7d25b6c18 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -111,7 +111,7 @@ class Application extends BaseApplication $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')) { + 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'); }