@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

bob 5bd52664 1b49165d

+3 -3
+2 -2
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 478 478 } 479 479 480 480 $author = $this->getRawAuthorStringForDisplay(); 481 - if (strlen($author)) { 481 + if (phutil_nonempty_string($author)) { 482 482 return DiffusionView::renderName($author); 483 483 } 484 484 ··· 493 493 } 494 494 495 495 $committer = $this->getRawCommitterStringForDisplay(); 496 - if (strlen($committer)) { 496 + if (phutil_nonempty_string($committer)) { 497 497 return DiffusionView::renderName($committer); 498 498 } 499 499
+1 -1
src/applications/repository/storage/PhabricatorRepositoryCommitData.php
··· 131 131 $ref = $this->getCommitRef(); 132 132 133 133 $committer = $ref->getCommitter(); 134 - if (strlen($committer)) { 134 + if (phutil_nonempty_string($committer)) { 135 135 return $committer; 136 136 } 137 137