From 4c590bc4d00d3a9eba27db8f78fc7e16f65fef29 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 15 Aug 2023 15:20:17 +0200 Subject: consistent variable name for stackframe, handle empty stackdump --- it_debug.class | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/it_debug.class b/it_debug.class index 8bd6099..5ed466a 100644 --- a/it_debug.class +++ b/it_debug.class @@ -240,7 +240,7 @@ static function backtrace($p = array()) $locations[] = basename($frame['file']) . ":" . $frame['line']; $argstrings = []; - foreach ($frame['args'] as $arg) + foreach ((array)$frame['args'] as $arg) { $t = trim(it::replace(['^array \(\s*' => "[", ',\n\)$' => "]", '^array \( \)' => "[]", " +" => " ", "\n" => ""], var_export($arg, true)), " ,"); $argstrings[] = strlen($t) < 60 ? $t : it::replace(["^(.{0,60} |.{0,60}).*" => '$1'], $t) . "..." . (is_array($arg) ? "]" : (is_object($arg) ? "}" :"")); @@ -260,12 +260,12 @@ static function backtrace($p = array()) } else { - foreach (self::debug_backtrace($p) as $call) + foreach (self::debug_backtrace($p) as $frame) { - $fn = $call['file']; + $fn = $frame['file']; $fn = (it::match('auto_prepend', $fn) ? basename(dirname(dirname($fn))) . "/" : (it::match('/(cgi|bin)/', $fn) ? basename(dirname($fn)) . "/" : "")) . basename($fn); if ($fn) - $result[] = $fn . ":" . $call['line']; + $result[] = $fn . ":" . $frame['line']; } $result = implode(" ", (array)$result); -- cgit v1.2.3