From faf1e994daa144fbc3dcaea30c2647266a752636 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 28 Aug 2023 15:04:20 +0200 Subject: handle inline errors, e.g. new $undefined in mail3464 --- it_debug.class | 2 +- test/it_error.t | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/it_debug.class b/it_debug.class index b36c232..1c95acf 100644 --- a/it_debug.class +++ b/it_debug.class @@ -250,7 +250,7 @@ static function backtrace($p = array()) if ($frame['type'] == "->" || $frame['type'] == "::") $funcs[] = $frame['class'] . $frame['type'] . $frame['function'] . "($allargs)"; else - $funcs[] = $frame['function'] . "($allargs)"; + $funcs[] = $frame['function'] ? $frame['function'] . "($allargs)" : "[inline]"; $maxlen = max(it::map('strlen', $locations)); } diff --git a/test/it_error.t b/test/it_error.t index 522d253..46f04d3 100755 --- a/test/it_error.t +++ b/test/it_error.t @@ -8,7 +8,7 @@ $GLOBALS['debug_verboseerrors'] = 1; if ($argv[1]) foo($argv[1]); else { - foreach (range(1, 10) as $testnum) { + foreach (range(1, 12) as $testnum) { $errlines = explode("\n", it::exec('{cmd} {testnum} |& cat', ['cmd' => $argv[0], 'testnum' => $testnum])); $expect = $expect = it::match('Expect: (.*)', $errlines[0]); $errbody = join("\n", array_slice($errlines, 1)); @@ -45,7 +45,8 @@ function foo($testno) case 7: expect(); $b = "hi" + 2; exit; # exception case 8: expect(); $b = 1 / 0; exit; # exception case 9: expect(); $a["bbb"] = 5; exit; # exception - case 10: expect(); filemtime("/foobar"); exit; # error - case 11: expect(); $b = $a["13th"]; exit; # error + case 10: expect(); $b = new $dummy; exit; # exception + case 11: expect(); filemtime("/foobar"); exit; # error + case 12: expect(); $b = $a["13th"]; exit; # error } } -- cgit v1.2.3