1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

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
This commit is contained in:
bob 2023-11-22 16:55:08 +01:00
parent 5bd5266461
commit acfb44d667

View file

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