From 45bcb13045500a88b583f1f86fce6bf0c2de08c1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 25 Sep 2023 16:32:20 -0400 Subject: [PATCH] Add backtrace to errors in json --- web/includes/functions.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/includes/functions.php b/web/includes/functions.php index aeb5f7933..74a6bfc3c 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1741,18 +1741,28 @@ function checkJsonError($value) { switch ( json_last_error() ) { case JSON_ERROR_DEPTH : ZM\Error("Unable to decode JSON string '$value', maximum stack depth exceeded"); + $backTrace = debug_backtrace(); + ZM\Debug($message.' from '.print_r($backTrace, true)); break; case JSON_ERROR_CTRL_CHAR : ZM\Error("Unable to decode JSON string '$value', unexpected control character found"); + $backTrace = debug_backtrace(); + ZM\Debug($message.' from '.print_r($backTrace, true)); break; case JSON_ERROR_STATE_MISMATCH : ZM\Error("Unable to decode JSON string '$value', invalid or malformed JSON"); + $backTrace = debug_backtrace(); + ZM\Debug($message.' from '.print_r($backTrace, true)); break; case JSON_ERROR_SYNTAX : ZM\Error("Unable to decode JSON string '$value', syntax error"); + $backTrace = debug_backtrace(); + ZM\Debug($message.' from '.print_r($backTrace, true)); break; default : ZM\Error("Unable to decode JSON string '$value', unexpected error ".json_last_error()); + $backTrace = debug_backtrace(); + ZM\Debug($message.' from '.print_r($backTrace, true)); break; case JSON_ERROR_NONE: break;