From 4c5a88a822b9ee9e640670d11b0607c3405982fa Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 29 Jul 2020 16:40:31 -0400 Subject: [PATCH] json decoding errors shouldnt' be fatal --- web/includes/functions.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 863918fbb..378ef04b0 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -2097,18 +2097,23 @@ function isVector(&$array) { function checkJsonError($value) { if ( function_exists('json_last_error') ) { - $value = var_export($value,true); - switch( json_last_error() ) { + $value = var_export($value, true); + switch ( json_last_error() ) { case JSON_ERROR_DEPTH : - ZM\Fatal("Unable to decode JSON string '$value', maximum stack depth exceeded"); + ZM\Error("Unable to decode JSON string '$value', maximum stack depth exceeded"); + break; case JSON_ERROR_CTRL_CHAR : - ZM\Fatal("Unable to decode JSON string '$value', unexpected control character found"); + ZM\Error("Unable to decode JSON string '$value', unexpected control character found"); + break; case JSON_ERROR_STATE_MISMATCH : - ZM\Fatal("Unable to decode JSON string '$value', invalid or malformed JSON"); + ZM\Error("Unable to decode JSON string '$value', invalid or malformed JSON"); + break; case JSON_ERROR_SYNTAX : - ZM\Fatal("Unable to decode JSON string '$value', syntax error"); + ZM\Error("Unable to decode JSON string '$value', syntax error"); + break; default : - ZM\Fatal("Unable to decode JSON string '$value', unexpected error ".json_last_error()); + ZM\Error("Unable to decode JSON string '$value', unexpected error ".json_last_error()); + break; case JSON_ERROR_NONE: break; }