diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1260,12 +1260,12 @@ static function json_encode($data, $p = []) } /** - * Decodes json data and provides warning if failed + * Decodes json data and provides warning if failed. Objects returned as objects by default * $p['assoc'] Return objects as assoc arrays */ static function json_decode($json, $p = []) { - return ($data = json_decode($json, $p['assoc'])) === null && trim($json) != 'null' ? it::error((array)$p['it_error'] + ['title' => "invalid json", 'body' => $json]) : $data; + return ($data = json_decode($json, $p['assoc'])) === null && trim($json) != 'null' ? it::error((array)$p['it_error'] + ['title' => "invalid json: " . json_last_error(), 'body' => $json]) : $data; } /** |