From 21b1a304b60a50392a5d92b03acdb7dca569e8d9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 19 Apr 2022 12:07:11 -0700 Subject: [PATCH] Improve some PHP 8.1 behavior in "bin/auth recover" Summary: Ref T13588. Fix a couple of argument parsing issues here. Test Plan: Ran "bin/auth recover" under PHP 8.1. Maniphest Tasks: T13588 Differential Revision: https://secure.phabricator.com/D21757 --- .../management/PhabricatorAuthManagementRevokeWorkflow.php | 4 ++-- .../editor/PhabricatorApplicationTransactionEditor.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php index 6d907e67d6..67ee746c2c 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementRevokeWorkflow.php @@ -60,7 +60,7 @@ final class PhabricatorAuthManagementRevokeWorkflow $type = $args->getArg('type'); $is_everything = $args->getArg('everything'); - if (!strlen($type) && !$is_everything) { + if ($type === null && !$is_everything) { if ($is_list) { // By default, "bin/revoke --list" implies "--everything". $types = $all_types; @@ -94,7 +94,7 @@ final class PhabricatorAuthManagementRevokeWorkflow $from = $args->getArg('from'); if ($is_list) { - if (strlen($from) || $is_everywhere) { + if ($from !== null || $is_everywhere) { throw new PhutilArgumentUsageException( pht( 'You can not "--list" and revoke credentials (with "--from" or '. diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 8d8dfeea5f..275636ca14 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -226,7 +226,7 @@ abstract class PhabricatorApplicationTransactionEditor public function getHeraldRuleMonograms() { // Convert the stored "<123>, <456>" string into a list: "H123", "H456". - $list = $this->heraldHeader; + $list = phutil_string_cast($this->heraldHeader); $list = preg_split('/[, ]+/', $list); foreach ($list as $key => $item) { @@ -2920,7 +2920,7 @@ abstract class PhabricatorApplicationTransactionEditor * @return bool True if the field will be an empty text field after edits. */ protected function validateIsEmptyTextField($field_value, array $xactions) { - if (strlen($field_value) && empty($xactions)) { + if (($field_value !== null && strlen($field_value)) && empty($xactions)) { return false; }