From 9cd61c21a99c1e9dd3d393179bdb5cbf9f898e6a Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sun, 13 Oct 2019 00:29:07 +0900 Subject: [PATCH] Update json.format.php --- helper/json.format.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/helper/json.format.php b/helper/json.format.php index 620e8ba..915e15c 100644 --- a/helper/json.format.php +++ b/helper/json.format.php @@ -11,16 +11,10 @@ if(!check_function_exists("json_decode_ex")) { "NO_FUNCTION_JSON_LAST_ERROR" => "json_last_error", ); $error = check_invaild_function($invalid_fn); + if($error < 0) { - $_result = false; - if(array_key_equals("assoc", $options, true)) { - $_result = @json_decode($data, true); - } else { - $_result = @json_decode($data); - } - if(@json_last_error() === 0) { - $result = $_result; - } + $_result = array_key_equals("assoc", $options, true) ? @json_decode($data, true) : @json_decode($data); + $result = (@json_last_error() === 0) ? $_result : $result; } return $result;