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

Fix PhabricatorRepository generateURI PHP 8.1 strlen(null) errors

Summary:
When viewing a repository in Diffusion, clicking on a folder (eg https://my.phorge.site/source/myrepo/browse/master/myfolder/) will generate multiple strlen(null) exceptions under PHP 8.1

Fix is to replace all the strlen() calls with phutil_nonempty_string()

Fixes T15532

Test Plan: View a folder in a repo in Diffusion. Eg https://my.phorge.site/source/myrepo/browse/master/myfolder/

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15532

Differential Revision: https://we.phorge.it/D25336
This commit is contained in:
Steve Campbell 2023-07-05 15:33:02 +01:00
parent 8af1624692
commit 849e18ccbb

View file

@ -779,15 +779,15 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
break;
case 'compare':
$uri = $this->getPathURI("/{$action}/");
if (strlen($head)) {
if (phutil_nonempty_scalar($head)) {
$query['head'] = $head;
} else if (strlen($raw_commit)) {
} else if (phutil_nonempty_scalar($raw_commit)) {
$query['commit'] = $raw_commit;
} else if (strlen($raw_branch)) {
} else if (phutil_nonempty_scalar($raw_branch)) {
$query['head'] = $raw_branch;
}
if (strlen($against)) {
if (phutil_nonempty_scalar($against)) {
$query['against'] = $against;
}
break;