From dfd3ba87fc81fb2f58160deb7b5115054da2fdc8 Mon Sep 17 00:00:00 2001 From: Landrok Date: Tue, 13 Sep 2016 22:36:43 +0200 Subject: [PATCH 1/2] Fix unescaped unicode encoding parameter 3rd parameter for json_encode is a max depth limitation. JSON_UNESCAPED_UNICODE has an int value of 256 whereas the max depth value is 512 (so no matter this way). This patch restores the expected usage of UNESCAPED_UNICODE param which is to encode multibyte Unicode characters literally. --- JSONRenderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSONRenderer.php b/JSONRenderer.php index 4f10757..1ce0c7d 100644 --- a/JSONRenderer.php +++ b/JSONRenderer.php @@ -53,7 +53,7 @@ public function renderReport(Report $report) $issue["fingerprint"] = $fingerprint; } - $json = json_encode($issue, JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE); + $json = json_encode($issue, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); $writer->write($json); $writer->write(chr(0)); } From 9fc9535dd4b913f0470452bec342e003a278b06d Mon Sep 17 00:00:00 2001 From: Landrok Date: Tue, 13 Sep 2016 22:59:28 +0200 Subject: [PATCH 2/2] Fix uncatchable exception L116 ``` } catch (Exception $e) { // can't be catched because CodeClimate\PHPMD\Exception does not exist``` Another way to fix this is: ``` } catch (\Exception $e) {``` --- Runner.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Runner.php b/Runner.php index abaeb7c..c316892 100644 --- a/Runner.php +++ b/Runner.php @@ -2,6 +2,7 @@ namespace CodeClimate\PHPMD; +use Exception; use PHPMD\PHPMD; use PHPMD\RuleSetFactory; use PHPMD\Writer\StreamWriter;