From 677e3b81ab2507fa2d1f33fc43d9a8804618a345 Mon Sep 17 00:00:00 2001 From: yukolonin Date: Thu, 29 Oct 2026 13:06:42 +0100 Subject: [PATCH] (61096) Improve return values for getCleanTalkResponseMethod --- lib/CleantalkAntispam.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); } /**