From 254fe9212a2a3626c6e796e49ca862e13754ab77 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Fri, 16 Nov 2018 20:19:50 +0100 Subject: [PATCH] [Debug] Fix debug mode reports indexing error Error log reports "PHP Notice: Undefined offset: 2 in /rss-bridge/ lib/Debug.php on line 112" if the array returned by debug_backtrace does not contain 3 items. This commit fixes the issue by always using the last element in the backtrace "end($backtrace)". --- lib/Debug.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Debug.php b/lib/Debug.php index 4901342d..f912fb3b 100644 --- a/lib/Debug.php +++ b/lib/Debug.php @@ -109,7 +109,7 @@ class Debug { } $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3); - $calling = $backtrace[2]; + $calling = end($backtrace); $message = $calling['file'] . ':' . $calling['line'] . ' class ' . (isset($calling['class']) ? $calling['class'] : '') . '->'