@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 preg_match with a NULL argument

Summary:
These calls are preventing users to browse subversion/mercurial repositories in PHP 8.1+.
Indeed, a similar bug affecting git repositories was already addressed in another commit
(rP6b8ec50148909938850b5acfd11725ae23a8e31b). This commit harmonize both DiffusionSvnRequest
and DiffusionMercurialRequest with DiffusionGitRequest

Fix T15607

Test Plan:
- Sign in
- Open a diffusion SVN/Mercurial repository
- You should not get a RuntimeException concerning this preg_match call

Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan

Reviewed By: O1 Blessed Committers, Sten, valerio.bozzolan

Subscribers: Sten, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15607

Differential Revision: https://we.phorge.it/D25397

bob a5d8b2d5 9fa9aa30

+6 -2
+3 -2
src/applications/diffusion/request/DiffusionMercurialRequest.php
··· 3 3 final class DiffusionMercurialRequest extends DiffusionRequest { 4 4 5 5 protected function isStableCommit($symbol) { 6 + if ($symbol === null) { 7 + return false; 8 + } 6 9 return preg_match('/^[a-f0-9]{40}\z/', $symbol); 7 10 } 8 11 ··· 10 13 if ($this->branch) { 11 14 return $this->branch; 12 15 } 13 - 14 16 if ($this->repository) { 15 17 return $this->repository->getDefaultBranch(); 16 18 } 17 - 18 19 throw new Exception(pht('Unable to determine branch!')); 19 20 } 20 21
+3
src/applications/diffusion/request/DiffusionSvnRequest.php
··· 3 3 final class DiffusionSvnRequest extends DiffusionRequest { 4 4 5 5 protected function isStableCommit($symbol) { 6 + if ($symbol === null) { 7 + return false; 8 + } 6 9 return preg_match('/^[1-9]\d*\z/', $symbol); 7 10 } 8 11