Page MenuHomePhorge

Fix numerous PHP 8.1 "strlen(null)" exceptions trying to create a project
ClosedPublic

Authored by aklapper on Apr 28 2023, 16:45.
Tags
None
Referenced Files
F3294766: D25140.1742942801.diff
Mon, Mar 24, 22:46
F3294534: D25140.1742937446.diff
Mon, Mar 24, 21:17
F3225129: D25140.1742093385.diff
Sat, Mar 15, 02:49
F3220568: D25140.1741810496.diff
Tue, Mar 11, 20:14
F3220567: D25140.1741810493.diff
Tue, Mar 11, 20:14
F3003314: D25140.1740462068.diff
Mon, Feb 24, 05:41
F3003212: D25140.1740458166.diff
Mon, Feb 24, 04:36
F3003211: D25140.1740458165.diff
Mon, Feb 24, 04:36

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 your phutil_nonempty_string() throws an exception, just
report it to Phorge to evaluate and fix together that specific corner case.

Closes T15286

Test Plan

Applied these five changes and /project/view/1/ finally rendered in web browser.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sgtm

src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php
34

✅ The input domain seems correct to me, since it should be a string or null and alien values should be reported.

Some context:

PhabricatorProfileMenuItemConfiguration.php
...
  public function getMenuItemProperty($key, $default = null) {
    return idx($this->menuItemProperties, $key, $default);
  }
...
src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php
24

✅ The input domain seems correct to me, since it should be a string or null and alien values should be reported. Same as above.

src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php
32

✅ The input domain seems correct to me, since it should be a string or null and alien values should be reported. Same as above.

src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php
41

✅ The input domain seems correct to me, since it should be a string or null and alien values should be reported. Same as above.

src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
620

✅ It's OK to assume a PHID as string or as NULL (default). Alien values will be reported and this is OK.

This revision is now accepted and ready to land.Apr 29 2023, 08:35