Homestyx hydra
Diffusion hydra d8d65f3f87ed

Fix PHP 8.1 "strlen(null)" exception on UIExamples' Bars page

Description

Fix PHP 8.1 "strlen(null)" exception on UIExamples' Bars page

Summary:
strlen() was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

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=b325304b6e52), phorge(head=uiExamples, ref.master=dd24c94b0741, ref.uiExamples=dd24c94b0741)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/view/phui/PHUISegmentBarSegmentView.php:58]

Closes T15441

Test Plan:
After applying this change, going to /uiexample/view/PhabricatorAphrontBarUIExample/,"Bars (PhabricatorAphrontBarUIExample)" renders with beautiful colors.

To see that page, enable prototypes with:

./bin/config set phabricator.show-prototypes true

Also try to create a Milestone on a Project, with the Config maniphest.points enabled, and try to create some Tasks with different points. Visit its Workboard to see the bar that still works with a useful tooltip.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15441

Differential Revision: https://we.phorge.it/D25272

Details

Provenance
Andre KlapperAuthored on Jun 3 2023, 5:50 AM
sirocylPushed on Oct 16 2024, 5:49 AM
Parents
R1:dd24c94b0741: Fix PHP 8.1 "strlen(null)" exceptions block creating a diff in Differential web…
Branches
Unknown
Tags
Unknown

Event Timeline