Page MenuHomePhorge

Installation: PHP 8.1 "strlen(null)" and "explode" exceptions block rendering Administrator Account Creation page
Closed, ResolvedPublic

Description

  1. Install Phorge at 8f669ea08289d144dfba24f19c6c94e2e444979d on PHP 8.1.8. Clean system; no Phorge/Phab DBs in MariaDB existing.
  2. Open http://phorge.localhost/
  3. Create initial first (=admin) user

phabInitUser-15-54-45.png (974×1 px, 47 KB)

  1. Select Create Admin Account button
  2. Get exceptions:
[2023-05-02 13:54:47] EXCEPTION: (RuntimeException) explode(): Passing null to parameter #2 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=T15263, ref.master=82d1abd4edd1, ref.T15263=4324d11c8b49), phorge(head=master, ref.master=8f669ea08289)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> explode(string, NULL, integer) called at [<phorge>/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php:94]
  #2 <#2> PhabricatorUserProfileImageCacheType::isRawCacheDataValid(PhabricatorUser, string, NULL) called at [<phorge>/src/applications/auth/engine/PhabricatorAuthSessionEngine.php:1113]
  #3 <#2> PhabricatorAuthSessionEngine::filterRawCacheData(PhabricatorUser, array, array) called at [<phorge>/src/applications/auth/engine/PhabricatorAuthSessionEngine.php:203]
  #4 <#2> PhabricatorAuthSessionEngine::loadUserForSession(string, string) called at [<phorge>/src/applications/base/controller/PhabricatorController.php:79]
  #5 <#2> PhabricatorController::willBeginExecution() called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:271]
  #6 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #7 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #8 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #9 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

[2023-05-02 13:54:47] EXCEPTION: (PhutilAggregateException) Encountered a processing exception, then another exception when trying to build a response for the first exception.
    - RuntimeException: file_exists(): Passing null to parameter #1 ($filename) of type string is deprecated
    - RuntimeException: explode(): Passing null to parameter #2 ($string) of type string is deprecated at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:316]
arcanist(head=T15263, ref.master=82d1abd4edd1, ref.T15263=4324d11c8b49), phorge(head=master, ref.master=8f669ea08289)
  #0 <#4> explode(string, NULL, integer) called at [<phorge>/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php:94]
  #1 <#4> PhabricatorUserProfileImageCacheType::isRawCacheDataValid(PhabricatorUser, string, NULL) called at [<phorge>/src/applications/auth/engine/PhabricatorAuthSessionEngine.php:1113]
  #2 <#4> PhabricatorAuthSessionEngine::filterRawCacheData(PhabricatorUser, array, array) called at [<phorge>/src/applications/auth/engine/PhabricatorAuthSessionEngine.php:203]
  #3 <#4> PhabricatorAuthSessionEngine::loadUserForSession(string, string) called at [<phorge>/src/applications/base/controller/PhabricatorController.php:79]
  #4 <#4> PhabricatorController::willBeginExecution() called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:271]
  #5 <#3> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #6 <#3> file_exists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1068]
  #7 <#3> Filesystem::pathExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1169]
  #8 <#3> Filesystem::assertExists(NULL) called at [<arcanist>/src/filesystem/Filesystem.php:1020]
  #9 <#3> Filesystem::isDescendant(NULL, string) called at [<phorge>/src/view/widget/AphrontStackTraceView.php:33]
  #10 <#3> AphrontStackTraceView::render() called at [<phorge>/src/view/AphrontView.php:222]
  #11 <#3> AphrontView::producePhutilSafeHTML() called at [<phorge>/src/infrastructure/markup/render.php:115]
  #12 <#3> phutil_escape_html(AphrontStackTraceView) called at [<phorge>/src/infrastructure/markup/render.php:139]
  #13 <#3> phutil_escape_html(array) called at [<phorge>/src/infrastructure/markup/render.php:97]
  #14 <#3> phutil_tag(string, array, array) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:67]
  #15 <#3> PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #16 <#3> AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #17 <#2> AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #18 <#2> AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]
  #19 phlog(PhutilAggregateException) called at [<phorge>/src/aphront/response/AphrontUnhandledExceptionResponse.php:32]
  #20 AphrontUnhandledExceptionResponse::setException(PhutilAggregateException) called at [<phorge>/webroot/index.php:46]

phabInitUser-15-55-21.png (974×1 px, 69 KB)

  1. After working around src/applications/people/cache/PhabricatorUserProfileImageCacheType.php:94, I temporarily added a phlog(pht('PhabricatorAuthSessionEngine: $data type is: %s', gettype($data))); lines in those four places which have isRawCacheDataValid function definitions or calls.
  1. Followup exception after applying workaround in step 6 (with custom temporary phlog output):
[2023-05-02 18:24:09] PHLOG: 'PhabricatorAuthSessionEngine: $data type is: NULL' at [/var/www/html/phorge/phorge/src/applications/auth/engine/PhabricatorAuthSessionEngine.php:1115]
[2023-05-02 18:24:09] EXCEPTION: (RuntimeException) strlen(): 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=T15284, ref.master=8f669ea08289, ref.T15284=8f669ea08289)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/applications/auth/constants/PhabricatorCookies.php:167]
  #1 <#2> PhabricatorCookies::parseNextURICookie(NULL) called at [<phorge>/src/applications/auth/constants/PhabricatorCookies.php:149]
  #2 <#2> PhabricatorCookies::getNextURICookie(AphrontRequest) called at [<phorge>/src/applications/auth/controller/PhabricatorAuthFinishController.php:72]
  #3 <#2> PhabricatorAuthFinishController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/AphrontController.php:71]
  #4 <#2> AphrontController::delegateToController(PhabricatorAuthFinishController) called at [<phorge>/src/applications/base/controller/PhabricatorController.php:156]
  #5 <#2> PhabricatorController::willBeginExecution() called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:271]
  #6 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #7 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #8 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #9 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:204]
  #10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]
[2023-05-02 18:24:09] PHLOG: 'PhabricatorUserProfileImageCacheType: $data type is: string' at [/var/www/html/phorge/phorge/src/applications/people/cache/PhabricatorUserProfileImageCacheType.php:96]

After also fixing src/applications/auth/constants/PhabricatorCookies.php:167, Phabricator homepage renders in web browser.

Also, now that $data is not null (anymore), last line of last stacktrace seems to imply that $data should be of type string.

Event Timeline

aklapper renamed this task from PHP 8.1: Exception passing null trying to create initial user account to Installation: PHP 8.1 exceptions block rendering Administrator Account Creation page.May 2 2023, 14:51
aklapper updated the task description. (Show Details)
aklapper edited projects, added People; removed Phorge.
aklapper renamed this task from Installation: PHP 8.1 exceptions block rendering Administrator Account Creation page to Installation: PHP 8.1 "strlen(null)" and "explode" exceptions block rendering Administrator Account Creation page.May 2 2023, 18:49
aklapper updated the task description. (Show Details)