From c962afc56611c3e953bc0ac1bcdca3a5241d33ac Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Mon, 30 Jul 2018 16:36:09 +1200 Subject: [PATCH] FIX Ensure that __toString return value is always casted as a string `json_encode` can return false on failure, which causes PHP errors since `__toString` must return a string. --- src/Language/AST/Node.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Language/AST/Node.php b/src/Language/AST/Node.php index 4645c4f..af9a775 100644 --- a/src/Language/AST/Node.php +++ b/src/Language/AST/Node.php @@ -84,7 +84,7 @@ abstract class Node public function __toString() { $tmp = $this->toArray(true); - return json_encode($tmp); + return (string) json_encode($tmp); } /**