[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)".
This commit is contained in:
logmanoriginal 2018-11-16 20:19:50 +01:00
parent 3806895059
commit 254fe9212a

View file

@ -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'] : '<no-class>') . '->'