Browse Source

Add warnings for xdebug, fixes #2425

Jordi Boggiano 11 years ago
parent
commit
10f8e564bb
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/Composer/Command/DiagnoseCommand.php

+ 18 - 0
src/Composer/Command/DiagnoseCommand.php

@@ -300,6 +300,12 @@ EOT
             $warnings['apc_cli'] = true;
         }
 
+        if (ini_get('xdebug.profiler_enabled')) {
+            $warnings['xdebug_profile'] = true;
+        } elseif (extension_loaded('xdebug')) {
+            $warnings['xdebug_loaded'] = true;
+        }
+
         ob_start();
         phpinfo(INFO_GENERAL);
         $phpinfo = ob_get_clean();
@@ -365,6 +371,18 @@ EOT
                         $text = PHP_EOL."Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
                         $text .= "Composer works with 5.3.2+ for most people, but there might be edge case issues.";
                         break;
+
+                    case 'xdebug_loaded':
+                        $text = PHP_EOL."The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
+                        $text .= "Disabling it when using Composer is recommended, but should not cause issues beyond slowness.";
+                        break;
+
+                    case 'xdebug_profile':
+                        $text = PHP_EOL."The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
+                        $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
+                        $text .= "    xdebug.profiler_enabled = 0";
+                        $displayIniMessage = true;
+                        break;
                 }
                 $out($text, 'warning');
             }