diff options
author | Urban Müller | 2023-08-15 15:20:17 +0200 |
---|---|---|
committer | Urban Müller | 2023-08-15 15:20:17 +0200 |
commit | 4c590bc4d00d3a9eba27db8f78fc7e16f65fef29 (patch) | |
tree | 6de2739f9aab9981638bd8593576ab0b5cae3989 | |
parent | 14a8629397ec70fc85472baca67c2a5d12d78257 (diff) | |
download | itools-4c590bc4d00d3a9eba27db8f78fc7e16f65fef29.tar.gz itools-4c590bc4d00d3a9eba27db8f78fc7e16f65fef29.tar.bz2 itools-4c590bc4d00d3a9eba27db8f78fc7e16f65fef29.zip |
consistent variable name for stackframe, handle empty stackdump
-rw-r--r-- | it_debug.class | 8 |
1 files 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); |