Page MenuHomePhorge

PHP 8.1 "ltrim(null)" exception blocks rendering first Meme comment
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. PHP 8.2.5; Phorge at 4d9719539773167058cf2b6bf6309945f1c5adba, with D25179 applied on top
  2. Have already a Macro created at http://phorge.localhost/macro/
  3. Now create a new Pholio mock:
  4. Go to http://phorge.localhost/pholio/create/
  5. Enter a Name
  6. Upload file
  7. Click Create button
  8. In Comment textfield at bottom, in its toolbar, click Meme button
  9. In the Create Meme dialog, select a Macro, leave the Above and Below fields empty, click Llama Diorama button to create
  10. See markup in Comment textfield
  11. Click Add Comment at bottom

Results:

  • Comment in Pholio Mock shows a red error message: trim(): Passing null to parameter #1 ($string) of type string is deprecated

foooo.png (974×960 px, 53 KB)

  • Get the following exception (four times repeated) in error log:
[2023-05-10 13:10:54] EXCEPTION: (RuntimeException) trim(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=renderDashboardTabPanelContent, ref.master=d47289622650, ref.renderDashboardTabPanelContent=d47289622650), phorge(head=master, ref.master=4d9719539773)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> trim(NULL) called at [<phorge>/src/applications/macro/engine/PhabricatorMemeEngine.php:185]
  #2 <#2> PhabricatorMemeEngine::newAssetData(PhabricatorFile) called at [<phorge>/src/applications/macro/engine/PhabricatorMemeEngine.php:164]
  #3 <#2> PhabricatorMemeEngine::newAssetFile(PhabricatorFile) called at [<phorge>/src/applications/macro/engine/PhabricatorMemeEngine.php:75]
  #4 <#2> PhabricatorMemeEngine::newAsset() called at [<phorge>/src/applications/macro/controller/PhabricatorMacroMemeController.php:21]
  #5 <#2> PhabricatorMacroMemeController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #6 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorAjaxRequestExceptionHandler.php:27]
  #7 PhabricatorAjaxRequestExceptionHandler::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:203]
  #10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]

Other comments:
Problem only happens for the first comment, no problem adding the second comment in the same mockup.
Cannot always reproduce the problem - reasons are unclear to me.