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)
Tue, Mar 26, 12:46
Unknown Object (File)
Tue, Mar 26, 11:32
Unknown Object (File)
Sun, Mar 17, 01:46
Unknown Object (File)
Thu, Mar 14, 15:15
Unknown Object (File)
Thu, Mar 14, 13:02
Unknown Object (File)
Wed, Mar 13, 19:36
Unknown Object (File)
Fri, Mar 8, 14:19
Unknown Object (File)
Feb 25 2024, 07:37

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

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