Page MenuHomePhorge

Fix PHP 8.1 "strlen(null)" exception which blocks rendering list of Active/All projects

Authored by aklapper on Apr 30 2023, 18:26.
Referenced Files
F1415739: D25162.id595.diff
Sun, Feb 25, 07:35
F1415738: D25162.id587.diff
Sun, Feb 25, 07:35
F1415737: D25162.id584.diff
Sun, Feb 25, 07:35
Sun, Feb 25, 06:54
F1415173: D25162.diff
Sun, Feb 25, 06:47
Unknown Object (File)
Thu, Feb 15, 01:50
Unknown Object (File)
Wed, Feb 14, 23:58
Unknown Object (File)
Wed, Feb 14, 23:56



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 T15312

Test Plan

Applied this change (on top of D25144, D25145, D25146, D25147, D25151, D25152, D25153 and /project/query/active/ rendered correctly in web browser.

Tested surfing various pages with and without Maniphest's maniphest.subtypes.

If you need some example custom fields, this is an example:

      "key": "default",
      "name": "Task"
      "key": "bug",
      "name": "Bug"
      "key": "log",
      "name": "LogSpam"
      "key": "deadline",
      "name": "Deadline"

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

valerio.bozzolan edited the test plan for this revision. (Show Details)
valerio.bozzolan edited the test plan for this revision. (Show Details)

hoping to be useful, add minor PHPDoc for future reference

Thanks for this fix! Tested locally with and without maniphest.subtypes confirming no explosions in various pages, also related to Maniphest Tasks with changed subtype.


✅ The only usage of setTagText() seems to be in PhabricatorEditEngineSubtype and the input domain is just a string coming from phutil_utf8_strtoupper() (like "BUG") or null (default). The phutil_nonempty_string() will report alien values and this is OK.

Also, the method was returning a bool, and it still returns a bool.

This revision is now accepted and ready to land.May 1 2023, 08:40