Page MenuHomePhorge

Fix arc patch in PHP 8.2: "preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated"
Closed, ResolvedPublic

Description

I tried arc patch D25111 in PHP 8.2 and I obtained this exception:

[2023-04-14 13:49:30] EXCEPTION: (RuntimeException) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=08dfffd5caf7), phorge(head=fix-git-commit-hook, ref.master=1b9da964e970, ref.fix-git-commit-hook=52608e018113)
  #0 PhutilErrorHandler::handleError(integer, string, string, integer)
  #1 preg_match(string, NULL, NULL) called at [<arcanist>/src/repository/api/ArcanistGitAPI.php:603]
  #2 ArcanistGitAPI::getCanonicalRevisionName(NULL) called at [<arcanist>/src/repository/api/ArcanistGitAPI.php:1146]
  #3 ArcanistGitAPI::hasLocalCommit(NULL) called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:432]
  #4 ArcanistPatchWorkflow::run() called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:398]
  #5 ArcanistPatchWorkflow::run() called at [<arcanist>/scripts/arcanist.php:427]
<<< [1] (+1,260) <exec> 1,260,422 us