From c943f3e7c02c6e26fb9d7857b779110660021b8a Mon Sep 17 00:00:00 2001 From: adlawson Date: Tue, 16 Feb 2016 15:02:27 +0000 Subject: [PATCH] Add comment explaining patch --- src/functions.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/functions.php b/src/functions.php index 07fb5a3..da97420 100644 --- a/src/functions.php +++ b/src/functions.php @@ -44,6 +44,8 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0) JSON_ERROR_SYNTAX => 'JSON_ERROR_SYNTAX - Syntax error, malformed JSON', JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded', ]; + + // Patched support for decoding empty strings for PHP 7+ $data = \json_decode($json == "" ? "{}" : $json, $assoc, $depth, $options); if (JSON_ERROR_NONE !== json_last_error()) {