Ver código fonte

Add env var to disable xdebug warnings, refs #4622

Jordi Boggiano 9 anos atrás
pai
commit
7a06615bf0

+ 4 - 0
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) →

+ 3 - 0
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.

+ 1 - 1
src/Composer/Console/Application.php

@@ -111,7 +111,7 @@ class Application extends BaseApplication
             $io->writeError('<warning>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.</warning>');
         }
 
-        if (extension_loaded('xdebug')) {
+        if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
             $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
         }