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