ソースを参照

Fix rendering of dev error pages in 8.3

- Add PHP8.3 HTML formatting to the list of replacements.
- Update styling to make output visually consistent in 8.3

Fixes #17491
Mark Story 2 年 前
コミット
b9fb532b88
2 ファイル変更7 行追加4 行削除
  1. 1 4
      src/Error/Debugger.php
  2. 6 0
      templates/layout/dev_error.php

+ 1 - 4
src/Error/Debugger.php

@@ -617,9 +617,6 @@ class Debugger
      */
     protected static function _highlight(string $str): string
     {
-        if (function_exists('hphp_log') || function_exists('hphp_gettid')) {
-            return htmlentities($str);
-        }
         $added = false;
         if (strpos($str, '<?php') === false) {
             $added = true;
@@ -628,7 +625,7 @@ class Debugger
         $highlight = highlight_string($str, true);
         if ($added) {
             $highlight = str_replace(
-                ['&lt;?php&nbsp;<br/>', '&lt;?php&nbsp;<br />'],
+                ['&lt;?php&nbsp;<br/>', '&lt;?php&nbsp;<br />', '&lt;?php'],
                 '',
                 $highlight
             );

+ 6 - 0
templates/layout/dev_error.php

@@ -292,6 +292,12 @@ use function Cake\Core\h;
     .excerpt-line {
         padding: 0;
     }
+    /* php 8.3 adds pre around highlighted code */
+    .code-highlight > pre,
+    .excerpt-line > pre {
+        padding: 0;
+        background: none;
+    }
     .excerpt-line > code {
         padding-left: 4px;
     }