FIX Debug::caller() will now handle errors from outside function calls (#6029)

This commit is contained in:
Daniel Hensby 2016-09-19 22:03:22 +01:00 committed by Sam Minnée
parent e93a376332
commit 32d1856d40

View File

@ -89,11 +89,12 @@ class Debug {
*/ */
public static function caller() { public static function caller() {
$bt = debug_backtrace(); $bt = debug_backtrace();
$caller = $bt[2]; $caller = isset($bt[2]) ? $bt[2] : array();
$caller['line'] = $bt[1]['line']; $caller['line'] = $bt[1]['line'];
$caller['file'] = $bt[1]['file']; $caller['file'] = $bt[1]['file'];
if(!isset($caller['class'])) $caller['class'] = ''; if(!isset($caller['class'])) $caller['class'] = '';
if(!isset($caller['type'])) $caller['type'] = ''; if(!isset($caller['type'])) $caller['type'] = '';
if(!isset($caller['function'])) $caller['function'] = '';
return $caller; return $caller;
} }