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
F2064345: D25189.diff
Thu, Mar 28, 17:38
Unknown Object (File)
Wed, Mar 27, 17:32
Unknown Object (File)
Tue, Mar 5, 23:03
Unknown Object (File)
Feb 25 2024, 07:36
Unknown Object (File)
Feb 25 2024, 07:36
Unknown Object (File)
Feb 25 2024, 06:54
Unknown Object (File)
Feb 25 2024, 06:46
Unknown Object (File)
Feb 14 2024, 03:22

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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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