From d725ffaa7728bdbcd07870e9e8f4d244eb9dcf41 Mon Sep 17 00:00:00 2001 From: Aviv Eyal Date: Sun, 2 Jul 2023 08:48:51 -0700 Subject: [PATCH] Fix "Register with Approval flow" for php 8 Summary: Ref T15064. Test Plan: - Register as a new user - as admin, view user's page and approve it - As new user, hit "wait patiently" to go back to Home No crashes in this flow. Reviewers: O1 Blessed Committers, chris Reviewed By: O1 Blessed Committers, chris Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15064 Differential Revision: https://we.phorge.it/D25317 --- .../auth/controller/PhabricatorAuthNeedsApprovalController.php | 2 +- src/applications/auth/engine/PhabricatorAuthPasswordEngine.php | 2 ++ .../customfield/standard/PhabricatorStandardCustomField.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php b/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php index 1121dfb14a..b098a07ddd 100644 --- a/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php +++ b/src/applications/auth/controller/PhabricatorAuthNeedsApprovalController.php @@ -51,7 +51,7 @@ final class PhabricatorAuthNeedsApprovalController $viewer, PhabricatorAuthWaitForApprovalMessageType::MESSAGEKEY); - if (!strlen($text)) { + if (!phutil_nonempty_string($text)) { return null; } diff --git a/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php b/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php index a1fec4a6d2..0efb1fe4fc 100644 --- a/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php +++ b/src/applications/auth/engine/PhabricatorAuthPasswordEngine.php @@ -150,6 +150,8 @@ final class PhabricatorAuthPasswordEngine $base_uri = new PhutilURI($base_uri); $blocklist[] = $base_uri->getDomain(); + $blocklist = array_filter($blocklist); + // Generate additional subterms by splitting the raw blocklist on // characters like "@", " " (space), and "." to break up email addresses, // readable names, and domain names into components. diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php index c41148a4aa..37f9e808ab 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php @@ -301,7 +301,7 @@ abstract class PhabricatorStandardCustomField } public function renderPropertyViewValue(array $handles) { - if (!strlen($this->getFieldValue())) { + if (!phutil_nonempty_string($this->getFieldValue())) { return null; } return $this->getFieldValue();