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.
This commit is contained in:
Christophe HENRY 2021-03-08 10:12:50 +01:00
parent d5f569baa9
commit 6a37ecebcf
1 changed files with 6 additions and 1 deletions

View File

@ -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.