From 8979ac0cc8fadae48e23a98242f14d593b5983bc Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Wed, 13 Jul 2022 11:59:57 +0300 Subject: [PATCH] Improving error line reporting --- bhl.inc.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bhl.inc.php b/bhl.inc.php index ecd6785..cc58af1 100644 --- a/bhl.inc.php +++ b/bhl.inc.php @@ -281,9 +281,7 @@ function bhl_handle_error_result(array $ret_out, $err_file, $exit = true) } $file = $jerr->file; - stderr("BHL ERROR: \n" . - $jerr->error . - " \nin '$file', line {$jerr->line}\n"); + stderr("BHL ERROR: \n" . $jerr->error . " \nin '$file', line {$jerr->line}\n"); stderr(bhl_show_position($jerr->line, $jerr->column, file($file)) . "\n"); if($exit) exit(1); @@ -361,7 +359,7 @@ function bhl_clean_cache() function bhl_show_position($line, $row, array $lines) { - if($line < count($lines)) + if($line > 0 && $line < count($lines)) { $txt = $lines[$line-1]; $c = str_repeat('-', $row);