mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-22 03:29:11 +01:00
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
This commit is contained in:
parent
c37412df45
commit
ac99285c57
5 changed files with 5 additions and 5 deletions
|
@ -31,7 +31,7 @@ final class PhabricatorProjectManageProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ final class PhabricatorProjectMembersProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ final class PhabricatorProjectSubprojectsProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ final class PhabricatorProjectWorkboardProfileMenuItem
|
|||
PhabricatorProfileMenuItemConfiguration $config) {
|
||||
$name = $config->getMenuItemProperty('name');
|
||||
|
||||
if (strlen($name)) {
|
||||
if (phutil_nonempty_string($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
|
|
|
@ -617,7 +617,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
return true;
|
||||
case PhabricatorTransactions::TYPE_SPACE:
|
||||
$space_phid = $xaction->getNewValue();
|
||||
if (!strlen($space_phid)) {
|
||||
if (!phutil_nonempty_string($space_phid)) {
|
||||
// If an install has no Spaces or the Spaces controls are not visible
|
||||
// to the viewer, we might end up with the empty string here instead
|
||||
// of a strict `null`, because some controller just used `getStr()`
|
||||
|
|
Loading…
Add table
Reference in a new issue