Page MenuHomePhorge

PHP 8.1 "rawurlencode(null)" exception in phutil_escape_uri
Closed, ResolvedPublic

Description

Fedora 38 machine with PHP 8.2.5. Just pulled Phorge; trying to set up a local Phorge test installation.

Trying to go to a workboard URL of any already existing/created workboard, like http://phorge.localhost/project/board/3/ (the DB and thus projects were still around from an older local Phabricator installation and thus not created in Phorge itself), and after working around T15262, I get:

Unhandled Exception ("RuntimeException"): rawurlencode(): Passing null to parameter #1 ($string) of type string is deprecated

triggered by
https://we.phorge.it/source/arcanist/browse/master/src/utils/utils.php$1891 containing
return str_replace('%2F', '/', rawurlencode($string));

Stacktrace, copied from T15313:

[2023-04-30 18:31:31] EXCEPTION: (RuntimeException) rawurlencode(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=82d1abd4edd1), phorge(head=D25163, ref.master=5a0d82df7f86, ref.D25163=5a0d82df7f86)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> rawurlencode(NULL) called at [<arcanist>/src/utils/utils.php:1891]
  #2 <#2> phutil_escape_uri(NULL) called at [<arcanist>/src/xsprintf/urisprintf.php:35]
  #3 <#2> xsprintf_uri(NULL, string, integer, NULL, integer) called at [<arcanist>/src/xsprintf/xsprintf.php:82]
  #4 <#2> xsprintf(string, NULL, array) called at [<arcanist>/src/xsprintf/urisprintf.php:19]
  #5 <#2> urisprintf(string, string, NULL) called at [<phorge>/src/applications/project/state/PhabricatorWorkboardViewState.php:106]
  #6 <#2> PhabricatorWorkboardViewState::newWorkboardURI() called at [<phorge>/src/applications/project/controller/PhabricatorProjectBoardViewController.php:393]
  #7 <#2> PhabricatorProjectBoardViewController::buildSortMenu(PhabricatorUser, PhabricatorProject, string, array) called at [<phorge>/src/applications/project/controller/PhabricatorProjectBoardViewController.php:310]
  #8 <#2> PhabricatorProjectBoardViewController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/AphrontController.php:71]
  #9 <#2> AphrontController::delegateToController(PhabricatorProjectBoardViewController) called at [<phorge>/src/applications/project/controller/PhabricatorProjectViewController.php:45]
  #10 <#2> PhabricatorProjectViewController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #11 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #12 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #13 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #14 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #15 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

[2023-04-30 18:31:31] EXCEPTION: (PhutilAggregateException) Encountered a processing exception, then another exception when trying to build a response for the first exception.
    - RuntimeException: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated
    - RuntimeException: rawurlencode(): Passing null to parameter #1 ($string) of type string is deprecated at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:316]
arcanist(head=master, ref.master=82d1abd4edd1), phorge(head=D25163, ref.master=5a0d82df7f86, ref.D25163=5a0d82df7f86)
  #0 <#4> rawurlencode(NULL) called at [<arcanist>/src/utils/utils.php:1891]
  #1 <#4> phutil_escape_uri(NULL) called at [<arcanist>/src/xsprintf/urisprintf.php:35]
  #2 <#4> xsprintf_uri(NULL, string, integer, NULL, integer) called at [<arcanist>/src/xsprintf/xsprintf.php:82]
  #3 <#4> xsprintf(string, NULL, array) called at [<arcanist>/src/xsprintf/urisprintf.php:19]
  #4 <#4> urisprintf(string, string, NULL) called at [<phorge>/src/applications/project/state/PhabricatorWorkboardViewState.php:106]
  #5 <#4> PhabricatorWorkboardViewState::newWorkboardURI() called at [<phorge>/src/applications/project/controller/PhabricatorProjectBoardViewController.php:393]
  #6 <#4> PhabricatorProjectBoardViewController::buildSortMenu(PhabricatorUser, PhabricatorProject, string, array) called at [<phorge>/src/applications/project/controller/PhabricatorProjectBoardViewController.php:310]
  #7 <#4> PhabricatorProjectBoardViewController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/AphrontController.php:71]
  #8 <#4> AphrontController::delegateToController(PhabricatorProjectBoardViewController) called at [<phorge>/src/applications/project/controller/PhabricatorProjectViewController.php:45]
  #9 <#4> PhabricatorProjectViewController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #10 <#3> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #11 <#3> strncmp(NULL, string, integer) called at [<arcanist>/src/filesystem/Filesystem.php:934]
  #12 <#3> Filesystem::isAbsolutePath(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:949]
  #13 <#3> Filesystem::resolvePath(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:859]
  #14 <#3> Filesystem::walkToRoot(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1180]
  #15 <#3> Filesystem::assertExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1020]
  #16 <#3> Filesystem::isDescendant(NULL, string) called at [<phorge>/src/view/widget/AphrontStackTraceView.php:33]
  #17 <#3> AphrontStackTraceView::render() called at [<phorge>/src/view/AphrontView.php:222]
  #18 <#3> AphrontView::producePhutilSafeHTML() called at [<phorge>/src/infrastructure/markup/render.php:115]
  #19 <#3> phutil_escape_html(AphrontStackTraceView) called at [<phorge>/src/infrastructure/markup/render.php:139]
  #20 <#3> phutil_escape_html(array) called at [<phorge>/src/infrastructure/markup/render.php:97]
  #21 <#3> phutil_tag(string, array, array) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:67]
  #22 <#3> PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #23 <#3> AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #24 <#2> AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #25 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]
  #26 phlog(PhutilAggregateException) called at [<phorge>/src/aphront/response/AphrontUnhandledExceptionResponse.php:32]
  #27 AphrontUnhandledExceptionResponse::setException(PhutilAggregateException) called at [<phorge>/webroot/index.php:46]

Event Timeline