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.

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