Page MenuHomePhorge

PHP 8.1 "strlen(null)" exception rendering PHUISegmentBar without a label
Open, Needs TriagePublic

Description

  1. PHP 8.2.8, Phorge at 3cc5ee6a33dfdf8e1e8bfcc12b655ebd516b3e5b
  2. In custom code, construct a PHUISegmentBarView without ->setLabel("foo"). For example, configure /config/edit/maniphest.points/ in your instance and then in /src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php replace $bar = id(new PHUISegmentBarView())->setLabel($label); with $bar = id(new PHUISegmentBarView()); and go to the page of a milestone project which has at least one task with story points associated.
[2023-08-19 07:57:36] 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=df6c315ace5f), phorge(head=master, ref.master=3cc5ee6a33df)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/view/phui/PHUISegmentBarView.php:33]
  #1 <#2> PHUISegmentBarView::getTagContent() called at [<phorge>/src/view/AphrontTagView.php:161]
  #2 <#2> AphrontTagView::render() called at [<phorge>/src/view/AphrontView.php:222]
  #3 <#2> AphrontView::producePhutilSafeHTML() called at [<phorge>/src/infrastructure/markup/render.php:115]
  #4 <#2> phutil_escape_html(PHUISegmentBarView) called at [<phorge>/src/infrastructure/markup/render.php:97]
  #5 <#2> phutil_tag(string, array, PHUISegmentBarView) called at [<phorge>/src/applications/project/menuitem/PhabricatorProjectPointsProfileMenuItem.php:162]
  #6 <#2> PhabricatorProjectPointsProfileMenuItem::newMenuItemViewList(PhabricatorProfileMenuItemConfiguration) called at [<phorge>/src/applications/search/menuitem/PhabricatorProfileMenuItem.php:77]
  #7 <#2> PhabricatorProfileMenuItem::getMenuItemViewList(PhabricatorProfileMenuItemConfiguration) called at [<phorge>/src/applications/search/storage/PhabricatorProfileMenuItemConfiguration.php:129]
  #8 <#2> PhabricatorProfileMenuItemConfiguration::getMenuItemViewList() called at [<phorge>/src/applications/search/engine/PhabricatorProfileMenuEngine.php:1293]
  #9 <#2> PhabricatorProfileMenuEngine::newProfileMenuItemViewList() called at [<phorge>/src/applications/search/engine/PhabricatorProfileMenuEngine.php:133]
  #10 <#2> PhabricatorProfileMenuEngine::buildResponse() called at [<phorge>/src/applications/project/controller/PhabricatorProjectMenuItemController.php:21]
  #11 <#2> PhabricatorProjectMenuItemController::handleRequest(AphrontRequest) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
  #12 phlog(RuntimeException) called at [<phorge>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
  #13 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
  #14 AphrontApplicationConfiguration::handleThrowable(RuntimeException) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
  #15 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phorge>/src/aphront/configuration/AphrontApplicationConfiguration.php:203]
  #16 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phorge>/webroot/index.php:35]