diff --git a/lib/CleantalkAntispam.php b/lib/CleantalkAntispam.php index ef46529..59bc5e1 100644 --- a/lib/CleantalkAntispam.php +++ b/lib/CleantalkAntispam.php @@ -163,7 +163,14 @@ private function getCleanTalkResponse() return new CleantalkResponse(null, null, $error); } - return new CleantalkResponse(@json_decode($response_raw), null); + if (is_array($response_raw)) { + $response = new CleantalkResponse(); + $response->error = $response_raw['error'] ?? 'Unexpected HTTP client response'; + + return $response; + } + + return new CleantalkResponse(json_decode($response_raw), null); } /**