Page MenuHomePhorge

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

Authored by aklapper on May 6 2023, 12:57.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 02:02
Unknown Object (File)
Thu, Apr 11, 11:02
Unknown Object (File)
Thu, Apr 11, 10:01
Unknown Object (File)
Wed, Apr 10, 12:35
Unknown Object (File)
Sun, Apr 7, 10:10
Unknown Object (File)
Sat, Apr 6, 05:17
Unknown Object (File)
Sun, Mar 31, 20:27
Unknown Object (File)
Sun, Mar 31, 12:33

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.

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

Repository
rP Phorge
Branch
configApp (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 369
Build 369: 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.

src/applications/meta/controller/PhabricatorApplicationDetailViewController.php
117

✅ 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