Page MenuHomePhorge

Fix PHP 8.1 "ltrim(null)" exception which blocks rendering five applications' Configure pages

Authored by aklapper on May 6 2023, 13:22.
Referenced Files
Unknown Object (File)
Thu, Apr 11, 11:40
Unknown Object (File)
Thu, Apr 11, 11:27
Unknown Object (File)
Thu, Apr 11, 10:32
Unknown Object (File)
Mon, Apr 8, 04:21
Unknown Object (File)
Fri, Apr 5, 20:18
Unknown Object (File)
Fri, Apr 5, 09:30
Unknown Object (File)
Sun, Mar 31, 16:40
Unknown Object (File)
Sun, Mar 31, 12:33



Since PHP 8.1, passing a null string to ltrim(string $string, string $characters) is deprecated.

Thus do not check for $path = null but check for $path = '' before passing $path as the $string parameter to ltrim(), like src/applications/settings/panel/PhabricatorSettingsPanel.php already does.

Closes T15359

Test Plan

Applied this change (on top of D25197) and five applications' Configure pages (Differential, Maniphest, Files, Paste, and Ponder) finally rendered in web browser.

Diff Detail

rP Phorge
Lint Not Applicable
Tests Not Applicable

Event Timeline

aklapper requested review of this revision.May 6 2023, 13:22

Thanks for this patch (again)

The approach seems 100% legit to me.

Just to be sure I tested this against each damn application:

Screenshot_2023_05_08_133448.png (98×1 px, 20 KB)

Aaaand, no implosions. For all the cases I monitored with phlog() the $path and the general assumption is correct.

Green light



✅ It seems that most PHPDoc stuff in Phorge ends with the dot, also in the first line.


✅ It seems "string?" is an usual way in Phorge to mark an optional parameter like in ./files/PhabricatorImageTransformer.php - I was honestly not aware of that, since PHPDoc does not have that formally.


I verified that all the code that extends this class does not rely on the old null default.

This is 100% legit since the argument goes directly into an ltrim() and so a NULL really should not arrive.

This revision is now accepted and ready to land.May 8 2023, 11:36