From 30de729e3d35fa6768d973f4c78f7b999741639d Mon Sep 17 00:00:00 2001 From: maxcxam Date: Sat, 22 Aug 2020 15:23:56 +0300 Subject: [PATCH] Update NovaPoshtaApi2.php NovaPoshtaApi2::prepare change if statement for array_key_exists, coz symfony returned status 500 with notice "Notice: Trying to access array offset on value of type null" ```if ($this->throwErrors and $result['errors']) {``` --- src/Delivery/NovaPoshtaApi2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Delivery/NovaPoshtaApi2.php b/src/Delivery/NovaPoshtaApi2.php index 4d7f34d..1c76f09 100644 --- a/src/Delivery/NovaPoshtaApi2.php +++ b/src/Delivery/NovaPoshtaApi2.php @@ -190,7 +190,7 @@ private function prepare($data) ? $data : json_decode($data, 1); // If error exists, throw Exception - if ($this->throwErrors and $result['errors']) { + if ($this->throwErrors and array_key_exists('errors', $result)) { throw new \Exception(is_array($result['errors']) ? implode("\n", $result['errors']) : $result['errors']); } return $result;