@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

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.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15286

Differential Revision: https://we.phorge.it/D25140

+5 -5
+1 -1
src/applications/project/menuitem/PhabricatorProjectManageProfileMenuItem.php
··· 31 31 PhabricatorProfileMenuItemConfiguration $config) { 32 32 $name = $config->getMenuItemProperty('name'); 33 33 34 - if (strlen($name)) { 34 + if (phutil_nonempty_string($name)) { 35 35 return $name; 36 36 } 37 37
+1 -1
src/applications/project/menuitem/PhabricatorProjectMembersProfileMenuItem.php
··· 21 21 PhabricatorProfileMenuItemConfiguration $config) { 22 22 $name = $config->getMenuItemProperty('name'); 23 23 24 - if (strlen($name)) { 24 + if (phutil_nonempty_string($name)) { 25 25 return $name; 26 26 } 27 27
+1 -1
src/applications/project/menuitem/PhabricatorProjectSubprojectsProfileMenuItem.php
··· 29 29 PhabricatorProfileMenuItemConfiguration $config) { 30 30 $name = $config->getMenuItemProperty('name'); 31 31 32 - if (strlen($name)) { 32 + if (phutil_nonempty_string($name)) { 33 33 return $name; 34 34 } 35 35
+1 -1
src/applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php
··· 38 38 PhabricatorProfileMenuItemConfiguration $config) { 39 39 $name = $config->getMenuItemProperty('name'); 40 40 41 - if (strlen($name)) { 41 + if (phutil_nonempty_string($name)) { 42 42 return $name; 43 43 } 44 44
+1 -1
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 617 617 return true; 618 618 case PhabricatorTransactions::TYPE_SPACE: 619 619 $space_phid = $xaction->getNewValue(); 620 - if (!strlen($space_phid)) { 620 + if (!phutil_nonempty_string($space_phid)) { 621 621 // If an install has no Spaces or the Spaces controls are not visible 622 622 // to the viewer, we might end up with the empty string here instead 623 623 // of a strict `null`, because some controller just used `getStr()`