Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering project's Configure Menu page

Authored by aklapper on May 1 2023, 23:01.
Referenced Files
Unknown Object (File)
Wed, May 31, 06:32
Unknown Object (File)
Tue, May 16, 23:17
Unknown Object (File)
Tue, May 16, 15:24
Unknown Object (File)
Tue, May 16, 08:04
Unknown Object (File)
Fri, May 12, 17:47



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 T15327

Test Plan

Applied this change (on top of D25166) and /project/1/item/configure/ rendered in web browser.

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.May 1 2023, 23:01

Thanks for this patch again!

I tested the $name locally intensively with phlog() to verify that it assumes just null or native string.

The function phutil_nonempty_string() will report any other alien type, and that is OK.

(The errors in the unit tests are totally unrelated and this will be discussed in T15334)

✅ green light and thanks


This revision is now accepted and ready to land.Wed, May 3, 10:24
This revision was landed with ongoing or failed builds.Wed, May 3, 10:50
This revision was automatically updated to reflect the committed changes.