1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

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
This commit is contained in:
epriestley 2022-04-19 12:07:11 -07:00
parent 3125d7a5f4
commit 21b1a304b6
2 changed files with 4 additions and 4 deletions

View file

@ -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 '.

View file

@ -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;
}