Skip to content

Commit 4400ed4

Browse files
authored
Merge pull request #9 from PBWebMedia/fix-json-decode-response-with-empty-array
Fix post response when json_decode results is an empty array
2 parents 17e641d + da12a8d commit 4400ed4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/RecommApi/Client.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ protected function post($uri, $timeout, $body) {
155155
$this->checkErrors($response);
156156

157157
$json = json_decode($response->body, true);
158-
if($json)
158+
159+
if($json !== null && json_last_error() == JSON_ERROR_NONE)
159160
return $json;
160161
else
161162
return $response->body;

0 commit comments

Comments
 (0)