Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks editing a Dashboard Tab Panel

Authored by aklapper on Thu, May 4, 16:30.
Referenced Files
Unknown Object (File)
Wed, May 31, 06:36
Unknown Object (File)
Tue, May 23, 13:59
Unknown Object (File)
Tue, May 23, 02:41
Unknown Object (File)
Mon, May 22, 22:10
Unknown Object (File)
Tue, May 16, 16:26



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.

Closes T15345

Test Plan

After applying this change, the "Edit Panel" page at /dashboard/panel/edit/2/ correctly rendered in the web browser.

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.Thu, May 4, 16:30
aklapper retitled this revision from PHP 8.1 "strlen(null)" exception blocks editing a Dashboard Tab Panel to Fix PHP 8.1 "strlen(null)" exception which blocks editing a Dashboard Tab Panel.Thu, May 4, 16:47

Thanks for this patch

I tested this patch locally and I can confirm that the expected incoming values are Dashboard PHIDs in the usual string form like "PHID-DSHB-fjjlqlfhgr2pc3k5vzhi" etc., or a potential null.

Also, the AphrontRequest#getStr() method always returns a string or NULL.

The phutil_nonempty_string() will report any alien value, and that is OK.

Thank you so much as usual


This revision is now accepted and ready to land.Fri, May 5, 11:40