diff --git a/PHPCI/Plugin/PhpCodeSniffer.php b/PHPCI/Plugin/PhpCodeSniffer.php index 3ecf2f48..37778e8a 100755 --- a/PHPCI/Plugin/PhpCodeSniffer.php +++ b/PHPCI/Plugin/PhpCodeSniffer.php @@ -157,7 +157,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin ); $output = $this->phpci->getLastOutput(); - list($errors, $warnings, $data) = $this->processReport(json_decode(trim($output), true)); + list($errors, $warnings, $data) = $this->processReport($output); $this->phpci->logExecOutput(true); @@ -198,9 +198,12 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin return array($ignore, $standard, $suffixes); } - protected function processReport($data) + protected function processReport($output) { + $data = json_decode(trim($output), true); + if (!is_array($data)) { + $this->phpci->log($output); throw new \Exception('Could not process PHPCS report JSON.'); } diff --git a/PHPCI/Plugin/PhpMessDetector.php b/PHPCI/Plugin/PhpMessDetector.php index deb6eafd..6b0f3a65 100755 --- a/PHPCI/Plugin/PhpMessDetector.php +++ b/PHPCI/Plugin/PhpMessDetector.php @@ -124,11 +124,12 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin } } - protected function processReport($xml) + protected function processReport($xmlString) { - $xml = simplexml_load_string($xml); + $xml = simplexml_load_string($xmlString); if ($xml === false) { + $this->phpci->log($xmlString); throw new \Exception('Could not process PHPMD report XML.'); }