From a3f680b12ec02d54019179394fad0081541c629c Mon Sep 17 00:00:00 2001 From: Keramat Jokar Date: Mon, 11 Mar 2024 01:49:31 +0330 Subject: [PATCH 1/2] System/Debug: Fix show Backtrace in PHP +8.3.0 --- system/Debug/Exceptions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index 1f5a5b52f03b..d16ce90879e5 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -541,9 +541,12 @@ public static function highlightFile(string $file, int $lineNumber, int $lines = return false; } + $version = explode('.', PHP_VERSION); + $php_version = (int)$version[0] * 10000 + (int)$version[1] * 100 + (int)$version[2]; + $source = str_replace(["\r\n", "\r"], "\n", $source); $source = explode("\n", highlight_string($source, true)); - $source = str_replace('
', "\n", $source[1]); + $source = str_replace('
', "\n", $php_version >= 80300 ? implode('
', $source) : $source[1]); $source = explode("\n", str_replace("\r\n", "\n", $source)); // Get just the part to show From 0e7170b66f87a4dad542ebde53ff71d86a5bb0e8 Mon Sep 17 00:00:00 2001 From: Keramat Jokar Date: Mon, 11 Mar 2024 11:12:18 +0330 Subject: [PATCH 2/2] Update Exceptions.php --- system/Debug/Exceptions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/Debug/Exceptions.php b/system/Debug/Exceptions.php index d16ce90879e5..29c695657f51 100644 --- a/system/Debug/Exceptions.php +++ b/system/Debug/Exceptions.php @@ -541,12 +541,9 @@ public static function highlightFile(string $file, int $lineNumber, int $lines = return false; } - $version = explode('.', PHP_VERSION); - $php_version = (int)$version[0] * 10000 + (int)$version[1] * 100 + (int)$version[2]; - $source = str_replace(["\r\n", "\r"], "\n", $source); $source = explode("\n", highlight_string($source, true)); - $source = str_replace('
', "\n", $php_version >= 80300 ? implode('
', $source) : $source[1]); + $source = str_replace('
', "\n", PHP_VERSION_ID >= 80300 ? implode('
', $source) : $source[1]); $source = explode("\n", str_replace("\r\n", "\n", $source)); // Get just the part to show