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

Fix a PHP 8.1 deprecated use of strlen with a NULL argument

Summary:
This call prevents users to view a commit in subversion repositories
Indeed, if commiter and/or author field is not properly defined strlen is call with a NULL argument.
Using strlen to check string validity is deprecated since PHP 8.1, phorge adopts phutil_nonempty_string() as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

Fix T15610

Test Plan:
- Sign in (if needed)
- Open a diffusion SVN repository
- Open a commit without user name and or email
- You should be able to view the commit

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15610

Differential Revision: https://we.phorge.it/D25400
This commit is contained in:
bob 2023-11-22 16:53:55 +01:00
parent 1b49165ddd
commit 5bd5266461
2 changed files with 3 additions and 3 deletions

View file

@ -478,7 +478,7 @@ final class PhabricatorRepositoryCommit
}
$author = $this->getRawAuthorStringForDisplay();
if (strlen($author)) {
if (phutil_nonempty_string($author)) {
return DiffusionView::renderName($author);
}
@ -493,7 +493,7 @@ final class PhabricatorRepositoryCommit
}
$committer = $this->getRawCommitterStringForDisplay();
if (strlen($committer)) {
if (phutil_nonempty_string($committer)) {
return DiffusionView::renderName($committer);
}

View file

@ -131,7 +131,7 @@ final class PhabricatorRepositoryCommitData extends PhabricatorRepositoryDAO {
$ref = $this->getCommitRef();
$committer = $ref->getCommitter();
if (strlen($committer)) {
if (phutil_nonempty_string($committer)) {
return $committer;
}