diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php
index dbfad7829..9dccfced3 100644
--- a/src/Composer/Command/DiagnoseCommand.php
+++ b/src/Composer/Command/DiagnoseCommand.php
@@ -385,23 +385,42 @@ EOT
private function outputResult($result)
{
$io = $this->getIO();
+ $hadError = false;
if (true === $result) {
$io->write('OK');
+ return;
+ }
+
+ if ($result instanceof \Exception) {
+ $result = '['.get_class($result).'] '.$result->getMessage().'';
+ }
+
+ if (!$result) {
+ // falsey results should be considered as an error, even if there is nothing to output
+ $hadError = true;
} else {
- $this->failures++;
- $io->write('FAIL');
- if ($result instanceof \Exception) {
- $io->write('['.get_class($result).'] '.$result->getMessage());
- } elseif ($result) {
- if (is_array($result)) {
- foreach ($result as $message) {
- $io->write($message);
- }
- } else {
- $io->write($result);
+ if (!is_array($result)) {
+ $result = array($result);
+ }
+ foreach ($result as $message) {
+ if (false !== strpos($message, '')) {
+ $hadError = true;
}
}
}
+
+ if ($hadError) {
+ $io->write('FAIL');
+ $this->failures++;
+ } else {
+ $io->write('WARNING');
+ }
+
+ if ($result) {
+ foreach ($result as $message) {
+ $io->write($message);
+ }
+ }
}
private function checkPlatform()