From 4741df680345781ead4e96a5188130ffd5a32472 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Fri, 22 Jan 2021 11:06:27 +0100 Subject: [PATCH] Allow json decode of received campaigns response The body is an instance of a stream. Therefore we need to cast so string before passing to json_decode. That's necessary because strict_types are forced. --- src/Api/Campaigns.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api/Campaigns.php b/src/Api/Campaigns.php index 3c652af..775d2d2 100644 --- a/src/Api/Campaigns.php +++ b/src/Api/Campaigns.php @@ -71,7 +71,7 @@ class Campaigns if ($result->getStatusCode() !== 200) { throw new \Exception('API key or user invalid.', 1605878128); } - $body = json_decode($result->getBody(), true); + $body = json_decode((string) $result->getBody(), true); $campaigns = []; foreach ($body['Campaigns'] as $campaign) { $campaigns[] = new Campaign($campaign, $this->settings);