Skip to content

Commit 0cf729d

Browse files
committed
updates for $source handling based on kenjis PR
1 parent 688c8ba commit 0cf729d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

system/Debug/BaseExceptionHandler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,17 @@ protected static function highlightFile(string $file, int $lineNumber, int $line
180180
return false;
181181
}
182182

183-
if (version_compare(PHP_VERSION, '8.3.0', '<')) {
184-
$source = str_replace(["\r\n", "\r"], "\n", $source);
185-
$source = explode("\n", highlight_string($source, true));
183+
$source = str_replace(["\r\n", "\r"], "\n", $source);
184+
$source = explode("\n", highlight_string($source, true));
185+
186+
if (PHP_VERSION_ID < 80300) {
186187
$source = str_replace('<br />', "\n", $source[1]);
188+
$source = explode("\n", str_replace("\r\n", "\n", $source));
187189
} else {
188-
$source = highlight_string($source, true);
189190
// We have to remove these tags since we're preparing the result
190191
// ourselves and these tags are added manually at the end.
191192
$source = str_replace(['<pre><code>', '</code></pre>'], '', $source);
192193
}
193-
$source = explode("\n", str_replace("\r\n", "\n", $source));
194194

195195
// Get just the part to show
196196
$start = max($lineNumber - (int) round($lines / 2), 0);

0 commit comments

Comments
 (0)