Update database.php

This commit is contained in:
Namhyeon Go 2019-02-26 11:20:54 +09:00 committed by GitHub
parent 5771190b78
commit b9f0fb1368
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -482,12 +482,13 @@ if(!function_exists("json_decode_to_assoc")) {
function json_decode_to_assoc($data) {
$result = array();
$func_rules = array(
"json_decode" => "Dose not exists json_decode function",
"json_last_error" => "Dose not exists json_last_error function",
$fn = array(
"NO_FUNCTION_JSON_DECODE" => "json_decode",
"NO_FUNCTION_JSON_LAST_ERROR" => "json_last_error",
);
if(check_function_exists($func_rules)) {
$error = check_invaild_function($fn);
if($error == -1) {
$obj = @json_decode($data, true);
$result = (@json_last_error() === 0) ? $obj : $result;
}