From 40fa6f2c0809f4eb01531b6c38f181344cac4bc5 Mon Sep 17 00:00:00 2001 From: Jerome Arzel Date: Mon, 5 Mar 2018 14:41:42 +0100 Subject: [PATCH] Throw a ServerException instead of Fatal when the server response is completely invalid. --- src/Snowcap/Emarsys/Client.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Snowcap/Emarsys/Client.php b/src/Snowcap/Emarsys/Client.php index bcd784a..9b985b6 100644 --- a/src/Snowcap/Emarsys/Client.php +++ b/src/Snowcap/Emarsys/Client.php @@ -820,6 +820,10 @@ protected function send($method = 'GET', $uri, array $body = array()) } } + if (is_array($responseArray) === false) { + throw new ServerException("JSON response is not an array:\n" . $responseArray); + } + return new Response($responseArray); }