Page MenuHomePhorge

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

Authored by aklapper on May 4 2023, 16:30.
Tags
None
Referenced Files
F2157776: D25189.diff
Thu, Apr 25, 00:54
Unknown Object (File)
Mon, Apr 22, 02:37
Unknown Object (File)
Sun, Apr 14, 11:00
Unknown Object (File)
Sun, Apr 14, 09:45
Unknown Object (File)
Sun, Apr 14, 09:37
Unknown Object (File)
Thu, Apr 11, 14:01
Unknown Object (File)
Thu, Apr 11, 02:15
Unknown Object (File)
Sun, Apr 7, 08:41

Details

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.

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

Repository
rP Phorge
Branch
createTabDashboardPanel (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 358
Build 358: arc lint + arc unit

Event Timeline

aklapper requested review of this revision.May 4 2023, 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.May 4 2023, 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

sgtm

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