From f4a639944de4fe141c5a5603736a492f6dd14bcc Mon Sep 17 00:00:00 2001 From: Valerio Bozzolan Date: Fri, 14 Apr 2023 22:12:36 +0200 Subject: [PATCH] Fix a PHP 8.1 issue related to preg_match() and null subject Summary: This change fixes 'arc patch' in some circumstances. Closes T15254 Test Plan: I was able to run "arc patch D25111" without issues Reviewers: O1 Blessed Committers, Matthew Reviewed By: O1 Blessed Committers, Matthew Subscribers: speck, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15187, T15254 Differential Revision: https://we.phorge.it/D25123 --- src/repository/api/ArcanistGitAPI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php index 6c6d2ac4..1ff299ec 100644 --- a/src/repository/api/ArcanistGitAPI.php +++ b/src/repository/api/ArcanistGitAPI.php @@ -600,7 +600,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI { public function getCanonicalRevisionName($string) { $match = null; - if (preg_match('/@([0-9]+)$/', $string, $match)) { + if ($string !== null && preg_match('/@([0-9]+)$/', $string, $match)) { $stdout = $this->getHashFromFromSVNRevisionNumber($match[1]); } else { list($stdout) = $this->execxLocal(