Skip to content

Commit

Permalink
Merge branch 'fix/ZES-37/logger-sanitize-data' into 'master'
Browse files Browse the repository at this point in the history
zip-37. Fix logger sanitize data function.

See merge request zip-au/plugins/zip.magento2!9
  • Loading branch information
james-gornell committed Oct 17, 2024
2 parents 12444b3 + 37dd04f commit b1466f1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Helper/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,18 @@ 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_null($debug)) {
return null;
}

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;
}
}

0 comments on commit b1466f1

Please sign in to comment.