From 6a37ecebcf8e13071d7c11ed417c52ae9f498ddf Mon Sep 17 00:00:00 2001 From: Christophe HENRY Date: Mon, 8 Mar 2021 10:12:50 +0100 Subject: [PATCH] Passes on next line in case of error, and log error When there are too many loops, indicating that something went wrong, sets the loop count to zero, the mode to default and go to the next line. --- htmgem.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htmgem.php b/htmgem.php index 9771c6c..ca7a4af 100644 --- a/htmgem.php +++ b/htmgem.php @@ -89,7 +89,12 @@ foreach ($fileLines as $line) { $reDoCount = 0; $mode_textAttributes_temp = false; while (true) { - if ($reDoCount>2) die("Too many loops: ".$mode); + if ($reDoCount>2) { + error_log("Too many loops, mode == '$mode'"); + $mode = null; + $reDoCount = 0; + break; + } $reDoCount += 1; $line1 = substr($line, 0, 1); // $line can be modified $line2 = substr($line, 0, 2); // in the meantime.