Page MenuHomePhorge

Fix strlen(null) when viewing a diff by git commit ID under PHP 8.1
Closed, ResolvedPublic

Description

When trying to view a diff by git commit ID under PHP 8.1 a strlen(null) error is thrown.

  1. Go into a diff (eg https://my.phorge.site/D1234)
  2. Click on the Revision Contents - History tab
  3. Click on a base link (the short git revision ID)

Stack trace:

AH01071: Got error 'PHP message: [2023-07-07 15:18:34] EXCEPTION: (RuntimeException) strlen(): Passing null to parameter
#1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]PHP message: arcanist(head=master, ref.master=8130241a11ac, custom=4), phorge(head=master, ref.master=7c1487e4dcfa)PHP message:
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/diffusion/view/DiffusionView.php:75]PHP message:
#1 <#2> DiffusionView::linkBrowse(string, array) called at [<phorge>/src/applications/diffusion/controller/DiffusionCommitController.php:1005]PHP message:
#2 <#2> DiffusionCommitController::buildTableOfContents(array, PHUIHeaderView, NULL) called at [<phorge>/src/applications/diffusion/controller/DiffusionCommitController.php:368]PHP message:
#3 <#2> DiffusionCommitController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]PHP message:
#4 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]PHP message:
#5 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]PHP message:
#6 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]PHP message:
#7 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]PHP message:
#8 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink)