diff --git a/.travis.yml b/.travis.yml index 9c49f3e..c5dbdff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ php: matrix: allow_failures: - - php: 7 - php: hhvm fast_finish: true diff --git a/src/functions.php b/src/functions.php index 3f08f8a..da97420 100644 --- a/src/functions.php +++ b/src/functions.php @@ -43,8 +43,10 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0) JSON_ERROR_CTRL_CHAR => 'JSON_ERROR_CTRL_CHAR - Unexpected control character found', JSON_ERROR_SYNTAX => 'JSON_ERROR_SYNTAX - Syntax error, malformed JSON', JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded', - ]; - $data = \json_decode($json, $assoc, $depth, $options); + ]; + + // Patched support for decoding empty strings for PHP 7+ + $data = \json_decode($json == "" ? "{}" : $json, $assoc, $depth, $options); if (JSON_ERROR_NONE !== json_last_error()) { $last = json_last_error();