Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering the Home page

Authored by aklapper on Apr 29 2023, 20:14.
Referenced Files
Unknown Object (File)
Sun, Jun 16, 05:30
Unknown Object (File)
Fri, Jun 14, 12:06
Unknown Object (File)
Fri, Jun 14, 12:04
Unknown Object (File)
Fri, Jun 14, 11:39
Unknown Object (File)
Thu, Jun 13, 23:45
Unknown Object (File)
Thu, Jun 13, 12:54
Unknown Object (File)
Wed, Jun 12, 13:01
Unknown Object (File)
Wed, Jun 12, 05:17



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 T15296

Test Plan

Applied this change and Home page rendered in web browser.

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

Tested locally. No nuclear implosions. Thanks!



✅ I debugged $name locally with phlog() to verify that it only assumes string or null, for example using the Edit Menu Item and similar stuff with fuzzy data.

The phutil_nonempty_string() will report alien values and that is OK.

This revision is now accepted and ready to land.May 1 2023, 09:05