Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering a project's page when Reports prototype enabled

Authored by aklapper on May 6 2023, 13:33.
Referenced Files
Unknown Object (File)
Wed, May 31, 06:38
Unknown Object (File)
Tue, May 23, 21:08
Unknown Object (File)
Sun, May 21, 16:46
Unknown Object (File)
Tue, May 16, 15:53
Unknown Object (File)
Tue, May 16, 03:28



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.

This is exactly the same case as D25140.

Closes T15360

Test Plan

Applied this change and /project/view/1/ rendered the workboard in the web browser as expected.

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.May 6 2023, 13:33
aklapper retitled this revision from Fix PHP 8.1 "strlen(null)" exception[s] which block rendering the XXXX page to Fix PHP 8.1 "strlen(null)" exception which blocks rendering a project's page when Reports prototype enabled.May 6 2023, 13:34

Thanks for this patch

I tested this locally logging $name and I confirm the bind between that and the menu name, that so it's a string or null (default).

The function phutil_nonempty_string() will report alien values, and that is OK here.

The lint errors are TOTALLY UNRELATED and related to T15334: PhabricatorProjectCoreTestCase: fix "Implicit conversion from float "

This revision is now accepted and ready to land.Mon, May 8, 11:51
This revision was landed with ongoing or failed builds.Mon, May 8, 12:35
This revision was automatically updated to reflect the committed changes.