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
F3323271: D25140.1743383762.diff
Sun, Mar 30, 01:16
F3322165: D25140.1743366538.diff
Sat, Mar 29, 20:28
F3321229: D25140.1743349258.diff
Sat, Mar 29, 15:40
F3320359: D25140.1743328308.diff
Sat, Mar 29, 09:51
F3318966: D25140.1743295085.diff
Sat, Mar 29, 00:38
F3315255: D25140.1743237448.diff
Fri, Mar 28, 08:37
F3306282: D25140.1743126529.diff
Thu, Mar 27, 01:48
F3298774: D25140.1743008908.diff
Tue, Mar 25, 17:08

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