Skip to content

Commit 56f9732

Browse files
committed
Added check to see if result is an array
1 parent d55393d commit 56f9732

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Picqer/Carriers/SendCloud/Connection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ public function parseResponse(Response $response)
183183
try {
184184
$resultArray = json_decode($response->getBody()->getContents(), true);
185185

186+
if (! is_array($resultArray)) {
187+
throw new SendCloudApiException('SendCloud error: Unexpected result: ' . $response->getBody()->getContents());
188+
}
189+
186190
if (array_key_exists('error', $resultArray)
187191
&& is_array($resultArray['error'])
188192
&& array_key_exists('message', $resultArray['error'])

0 commit comments

Comments
 (0)