diff options
author | Urban Müller | 2025-04-10 14:21:36 +0200 |
---|---|---|
committer | Urban Müller | 2025-04-10 14:21:36 +0200 |
commit | ff13a5ee14cdb31307ecb16ddf2ab9f89d5d61ea (patch) | |
tree | 25c9647dd578b7befea08143be0bfdeb5645e904 /it.class | |
parent | e8b681292ae469a64df6033965babbe63be0290b (diff) | |
download | itools-ff13a5ee14cdb31307ecb16ddf2ab9f89d5d61ea.tar.gz itools-ff13a5ee14cdb31307ecb16ddf2ab9f89d5d61ea.tar.bz2 itools-ff13a5ee14cdb31307ecb16ddf2ab9f89d5d61ea.zip |
json_decode: return json error in title
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; } /** |