From acfb44d6679edc87e9f209f011e77ee2594cd8ae Mon Sep 17 00:00:00 2001 From: bob Date: Wed, 22 Nov 2023 16:55:08 +0100 Subject: [PATCH] Fix a PHP 8.1 deprecated use of strlen with a NULL argument on commit page Summary: With PHP 8.1+ it is not possible to view a commit if the author field is not properly defined Indeed, if the commit author is not properly defined, strlen(null) is called, causing a deprecation warning, elevated to exception. Using strlen() to check string validity is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement. Fix T15628 Test Plan: - Push a new commit on a subversion repository (since T15629 is not yet addressed) - Visualize the commit - You should not get a RuntimeException Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan Reviewed By: O1 Blessed Committers, Sten, valerio.bozzolan Subscribers: Sten, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15628 Differential Revision: https://we.phorge.it/D25422 --- .../repository/storage/PhabricatorRepositoryCommitData.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommitData.php b/src/applications/repository/storage/PhabricatorRepositoryCommitData.php index 4726658b7a..96508a2452 100644 --- a/src/applications/repository/storage/PhabricatorRepositoryCommitData.php +++ b/src/applications/repository/storage/PhabricatorRepositoryCommitData.php @@ -97,7 +97,7 @@ final class PhabricatorRepositoryCommitData extends PhabricatorRepositoryDAO { $ref = $this->getCommitRef(); $author = $ref->getAuthor(); - if (strlen($author)) { + if (phutil_nonempty_string($author)) { return $author; }