Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering most applications' Configure pages

Authored by aklapper on May 6 2023, 12:57.
Referenced Files
Unknown Object (File)
Thu, Sep 21, 06:49
Unknown Object (File)
Sat, Sep 16, 13:45
Unknown Object (File)
Sun, Sep 10, 10:23
Unknown Object (File)
Sun, Sep 10, 06:28
Unknown Object (File)
Fri, Sep 8, 20:46
Unknown Object (File)
Mon, Sep 4, 15:48
Unknown Object (File)
Mon, Sep 4, 15:48
Unknown Object (File)
Mon, Sep 4, 15:48



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.

Added also a small inline documentation to better leave what I find.

Closes T15358

Test Plan

Applied this change change and way more applications' Configure pages finally rendered in web browser.
For example, /applications/view/PhabricatorAuditApplication/ is now correctly rendered.
(However, some pages expose followup exceptions to be handled in separate tasks.)

Diff Detail

rP Phorge
Lint Passed
Tests Passed
Build Status
Buildable 377
Build 377: arc lint + arc unit

Event Timeline

aklapper requested review of this revision.May 6 2023, 12:57

Thanks for this patch (again)

I tested this locally against all launcher applications, no implosions.

The Overview is never an object.

Hoping to be useful I will also attach some minor related PHPDoc.


✅ I verified that the $application->getOverview() method only returns null or strings (raw remarkup).

The method phutil_nonempty_string() will report any alien type, and that is OK here.

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

add small PHPDoc related documentation to clarify further reviews