Skip to content

Commit 7b217e4

Browse files
Merge pull request #8438 from Sesquipedalian/3.0/err_log_tweak
Fixes blank screens when showing file content in error log
2 parents 3970f7e + 477f720 commit 7b217e4

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Sources/Actions/Admin/ErrorLog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public function viewFile(): void
430430
ErrorHandler::fatalLang('error_bad_line');
431431
}
432432

433-
$file_data = explode('<br />', Parser::highlightPhpCode(Utils::htmlspecialchars(file_get_contents($file))));
433+
$file_data = preg_split('~\R|<br(\s*/)?>~', Parser::highlightPhpCode(Utils::htmlspecialchars(file_get_contents($file))));
434434

435435
// We don't want to slice off too many so lets make sure we stop at the last one
436436
$max = min($max, max(array_keys($file_data)));

Sources/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ public static function highlightPhpCode(string $code): string
389389
[
390390
'~(?:' . Utils::TAB_SUBSTITUTE . ')+~u' => fn($matches) => '<span style="white-space: pre;">' . strtr($matches[0], [Utils::TAB_SUBSTITUTE => "\t"]) . '</span>',
391391
'~<span style="color: #[0-9a-fA-F]{6}">(<span style="white-space: pre;">\h*</span>)</span>~' => fn($matches) => $matches[1],
392-
'~\R~' => fn($matches) => '<br>',
392+
'~\R~' => fn($matches) => '<br />',
393393
'/\'/' => fn($matches) => '&#039;',
394394
// PHP 8.3 changed the returned HTML.
395395
'/^(<pre>)?<code[^>]*>|<\/code>(<\/pre>)?$/' => fn($matches) => '',

0 commit comments

Comments
 (0)