From 6b92e75f2c8be13fd57a5db41d7a52f831e8877e Mon Sep 17 00:00:00 2001 From: ruzann <40264956+ruzann@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:13:07 +0400 Subject: [PATCH] Update BlockChypException.php before doing json_decode() checked if $httpBody exist --- lib/Exception/BlockChypException.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Exception/BlockChypException.php b/lib/Exception/BlockChypException.php index a6c42ed..6c720a8 100644 --- a/lib/Exception/BlockChypException.php +++ b/lib/Exception/BlockChypException.php @@ -24,7 +24,10 @@ public static function factory($message, $httpStatus = null, $httpBody = null) $instance = new static($message); $instance->setHttpStatus($httpStatus); $instance->setHttpBody($httpBody); - $instance->setJsonBody(json_decode($httpBody, true)); + if (isset($httpBody)) { + $httpBody = json_decode($httpBody, true); + } + $instance->setJsonBody($httpBody); return $instance; }