From e7e33b1c230214dbe03b0f764770da90775f8818 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 13 Mar 2024 21:10:08 +0100 Subject: [PATCH] Correct signature of Trustly_Data::json() --- Trustly/Api/api.php | 3 +++ Trustly/Data/data.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Trustly/Api/api.php b/Trustly/Api/api.php index c9fee7d..9bf914c 100644 --- a/Trustly/Api/api.php +++ b/Trustly/Api/api.php @@ -473,6 +473,9 @@ public function call($request) { $this->last_request = $request; $jsonstr = $request->json(); + if($jsonstr === FALSE) { + throw new Trustly_DataException('Unable to json encode payload'); + } $url = $this->url($request); list($body, $response_code) = $this->post($url, $jsonstr); diff --git a/Trustly/Data/data.php b/Trustly/Data/data.php index a77274b..e2f8643 100644 --- a/Trustly/Data/data.php +++ b/Trustly/Data/data.php @@ -158,7 +158,7 @@ public function pop($name) { * @param boolean $pretty Format the output in a prettified easy-to-read * formatting * - * @return string The current payload in JSON + * @return string|false The current payload in JSON */ public function json($pretty=FALSE) { if($pretty) {