Json: Fix trying to decode null data deprecation error
This commit is contained in:
parent
74022ae4e0
commit
340364ee9c
|
@ -85,7 +85,7 @@ class Json
|
||||||
*/
|
*/
|
||||||
public static function decode($json, $assoc = false, $depth = 512, $options = 0)
|
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) {
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
throw new JsonDecodeException('%s: %s', json_last_error_msg(), var_export($json, true));
|
throw new JsonDecodeException('%s: %s', json_last_error_msg(), var_export($json, true));
|
||||||
|
|
Loading…
Reference in New Issue