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) {