mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +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:
parent
1b49165ddd
commit
5bd5266461
2 changed files with 3 additions and 3 deletions
|
@ -478,7 +478,7 @@ final class PhabricatorRepositoryCommit
|
||||||
}
|
}
|
||||||
|
|
||||||
$author = $this->getRawAuthorStringForDisplay();
|
$author = $this->getRawAuthorStringForDisplay();
|
||||||
if (strlen($author)) {
|
if (phutil_nonempty_string($author)) {
|
||||||
return DiffusionView::renderName($author);
|
return DiffusionView::renderName($author);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ final class PhabricatorRepositoryCommit
|
||||||
}
|
}
|
||||||
|
|
||||||
$committer = $this->getRawCommitterStringForDisplay();
|
$committer = $this->getRawCommitterStringForDisplay();
|
||||||
if (strlen($committer)) {
|
if (phutil_nonempty_string($committer)) {
|
||||||
return DiffusionView::renderName($committer);
|
return DiffusionView::renderName($committer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ final class PhabricatorRepositoryCommitData extends PhabricatorRepositoryDAO {
|
||||||
$ref = $this->getCommitRef();
|
$ref = $this->getCommitRef();
|
||||||
|
|
||||||
$committer = $ref->getCommitter();
|
$committer = $ref->getCommitter();
|
||||||
if (strlen($committer)) {
|
if (phutil_nonempty_string($committer)) {
|
||||||
return $committer;
|
return $committer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue