From 4134ca0a2d4ee89acf485cf7cc4e8046100032de Mon Sep 17 00:00:00 2001 From: Marius Matei Date: Thu, 10 Nov 2022 18:15:48 +0200 Subject: [PATCH] Fix json_encode deprecation warning Since `developerPayload` is not mandatory `json_encode()` will throw a deprecation warning in PHP8 when `developerPayload` is null. --- src/GooglePlay/PurchaseResponse.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GooglePlay/PurchaseResponse.php b/src/GooglePlay/PurchaseResponse.php index ab6b113..9876698 100644 --- a/src/GooglePlay/PurchaseResponse.php +++ b/src/GooglePlay/PurchaseResponse.php @@ -19,7 +19,9 @@ class PurchaseResponse extends AbstractResponse public function __construct($response) { parent::__construct($response); - $this->developerPayload = json_decode($this->response->developerPayload, true); + if (isset($this->response->developerPayload)) { + $this->developerPayload = json_decode($this->response->developerPayload, true); + } } /**