1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-19 16:38:51 +02:00

Correct a PHP8 compatibility issue when running "arc diff" with no active branch

Summary:
When there is no active branch name, arc diff currently fails under PHP8 when we try to strlen(null).

This change is also credited to Evan from upstream Phabricator that applied the same change:

https://secure.phabricator.com/rARCc39ab20eb3717a15aed2467842bd77d9addce96a

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.

Closes T15412

Test Plan: Under PHP 8.1: ran git checkout <hash of head>, then arc diff to generate this revision.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15412

Differential Revision: https://we.phorge.it/D25237
This commit is contained in:
jkim 2023-05-23 13:43:33 +01:00
parent e4fd31ec02
commit 0e32dbc1ac

View file

@ -2361,7 +2361,7 @@ EOTEXT
// If we track an upstream branch either directly or indirectly, use that.
$branch = $api->getBranchName();
if (strlen($branch)) {
if (phutil_nonempty_string($branch)) {
$upstream_path = $api->getPathToUpstream($branch);
$remote_branch = $upstream_path->getRemoteBranchName();
if ($remote_branch !== null) {