Json: Fix trying to decode null data deprecation error

This commit is contained in:
Yonas Habteab 2022-05-17 11:56:17 +02:00 committed by Johannes Meyer
parent 74022ae4e0
commit 340364ee9c
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ class Json
*/
public static function decode($json, $assoc = false, $depth = 512, $options = 0)
{
$decoded = json_decode($json, $assoc, $depth, $options);
$decoded = $json ? json_decode($json, $assoc, $depth, $options) : null;
if (json_last_error() !== JSON_ERROR_NONE) {
throw new JsonDecodeException('%s: %s', json_last_error_msg(), var_export($json, true));