Page MenuHomePhorge

PHP 8.1 exceptions in JsonLint block rendering Tab Panels in Dashboards
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. PHP 8.2.6; Arcanist at 0e32dbc1ac8fe6ae03860640520c104fd6f8fe16
  2. Go to an existing dashboard, like http://phorge.localhost/dashboard/view/1/
  3. Select the Create Panel button
  4. Select Tab Panel to go to http://phorge.localhost/dashboard/panel/edit/?contextPHID=PHID-DSHB-ophnrt7yzfiqm5xqtoa3&columnKey=main&panelType=tabs
  5. Enter tabpaneltest in the Name field.
  6. Select the Create Panel button.
  7. Go back to http://phorge.localhost/dashboard/view/1/

Expected outcome:
New panel displays This tab panel does not have any tabs yet.

Actual outcome:
New panel displays RuntimeException: substr(): Passing null to parameter #1 ($string) of type string is deprecated:

deadtabpanel01.png (974×1 px, 62 KB)

Other comments:
With Phorge's Developer Mode enabled, no stacktrace is printed in the PHP error log or in DarkConsole (after applying D25165 and D25188).

diff --git a/src/error/PhutilErrorHandler.php b/src/error/PhutilErrorHandler.php
index 63d5b492..a4d8f0bf 100644
--- a/src/error/PhutilErrorHandler.php
+++ b/src/error/PhutilErrorHandler.php
@@ -258,7 +258,8 @@ final class PhutilErrorHandler extends Phobject {
 
     // See T13499. Convert all other runtime errors not handled in a more
     // specific way into runtime exceptions.
-    throw new RuntimeException($str);
+    $whatever = $str." in ".$file.":".$line;
+    throw new RuntimeException($whatever);
   }
 
   /**

adds the source file and line to the error message output:

deadtabpanel02.png (974×1 px, 69 KB)

Working around that line leads to more exceptions:
tabpaneldead-03.png (974×1 px, 70 KB)

tabpaneldead-04.png (974×1 px, 68 KB)