diff --git a/code/Debug/Helper/Data.php b/code/Debug/Helper/Data.php index e406fa5..fbd1288 100644 --- a/code/Debug/Helper/Data.php +++ b/code/Debug/Helper/Data.php @@ -267,7 +267,7 @@ public function formatMemorySize($size, $precision = 2) * @param string $stripFilepath * @return string */ - public function formatStacktrace(array $trace, $stripFilepath = '', $trimPath='') + public function formatStacktrace(array $trace, $stripFilepath = '', $trimPath = '') { $out = ''; foreach ($trace as $index => $row) { @@ -276,12 +276,17 @@ public function formatStacktrace(array $trace, $stripFilepath = '', $trimPath='' continue; } - if ($trimPath) { + if ($trimPath && isset($row['file'])) { $row['file'] = str_replace($trimPath, '', $row['file']); } - // sometimes there is undefined index 'file' - @$out .= "[$index] {$row['file']}:{$row['line']}\n"; + if (isset($row['file'])) { + $out .= "[$index] {$row['file']}:{$row['line']}\n"; + } else { + // sometimes there is undefined index 'file' + $out .= "[$index] (?) {$row['class']}:{$row['function']}\n"; + } + } return $out;