From 9ef6e96527cdc1d2f2574d7e9edda5f2ba4ec6f2 Mon Sep 17 00:00:00 2001 From: Dmytro Plish Date: Thu, 17 Oct 2024 16:15:08 +0300 Subject: [PATCH 1/2] zip-37. Fix logger sanitize data function. --- Helper/Logger.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Helper/Logger.php b/Helper/Logger.php index b4f8f1d..8961f65 100644 --- a/Helper/Logger.php +++ b/Helper/Logger.php @@ -177,14 +177,14 @@ public function getPrivateData() public function sanitizePrivateData($debug) { - if ((is_string($debug) || is_object(json_decode($debug)) || is_array(json_decode($debug, true))) && !empty($debug)) { + if (is_scalar($debug) || is_array(json_decode($debug, true))) { $json = json_decode($debug, true); if (is_array($json)) { return json_encode($this->sanitizeArrData($json)); } } elseif (is_array($debug)) { - return $this->sanitizeArrData($debug); + return json_encode($this->sanitizeArrData($debug)); } - return $debug; + return (string) $debug; } } From 37dd04f7f7da4f0a366a14898bda8908a66961df Mon Sep 17 00:00:00 2001 From: Dmytro Plish Date: Thu, 17 Oct 2024 16:50:19 +0300 Subject: [PATCH 2/2] zip-37. Fix logger sanitize data function. --- Helper/Logger.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Helper/Logger.php b/Helper/Logger.php index 8961f65..739d044 100644 --- a/Helper/Logger.php +++ b/Helper/Logger.php @@ -177,6 +177,10 @@ public function getPrivateData() public function sanitizePrivateData($debug) { + if (is_null($debug)) { + return null; + } + if (is_scalar($debug) || is_array(json_decode($debug, true))) { $json = json_decode($debug, true); if (is_array($json)) {