Page MenuHomePhorge

Fix Subversion "commit" support in PHP 8.1
ClosedPublic

Authored by valerio.bozzolan on Dec 14 2023, 17:29.
Tags
None
Referenced Files
F3299259: D25498.1743018951.diff
Tue, Mar 25, 19:55
F3295598: D25498.1742957605.diff
Tue, Mar 25, 02:53
F3294537: D25498.1742937561.diff
Mon, Mar 24, 21:19
F3284058: D25498.1742765416.diff
Sat, Mar 22, 21:30
F3249335: D25498.1742285717.diff
Mon, Mar 17, 08:15
F3215646: D25498.1741657483.diff
Mon, Mar 10, 01:44
F3212749: D25498.1741480189.diff
Sat, Mar 8, 00:29
F3181044: D25498.1741324567.diff
Thu, Mar 6, 05:16

Details

Summary

Premising that "arc commit" is a beautiful Workflow dedicated to svn repositories,
I tried it at work, causing the usual PHP 8.1 deprecation warning:

$ arc diff
$ arc commit
ERROR 8192: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated at [arcanist/src/workflow/ArcanistWorkflow.php:1520]
arcanist(head=master, ref.master=e46025f7a914)
  #0 preg_replace(string, string, NULL) called at [<arcanist>/src/workflow/ArcanistWorkflow.php:1520]
  #1 ArcanistWorkflow::normalizeRevisionID(NULL) called at [<arcanist>/src/workflow/ArcanistCommitWorkflow.php:68]
  #2 ArcanistCommitWorkflow::run() called at [<arcanist>/scripts/arcanist.php:427]
Usage Exception: Unable to identify the revision in the working copy. Use '--revision <revision_id>' to select a revision.

This bug happens at least when Arcanist does not find any related Revision ID.

It seems there is a method that always normalizes the Revision ID, but sometime that is unknown (null).
And so, NULL ends inside a preg_replace(). It's probably OK to have a normalize method that accept wild
things, including NULL. So, fixed that specific method.

Closes T15693

Test Plan

This revision was tested in production in my company.

Take a random Subversion repository. Edit a line. Run "arc diff". Then run "arc commit". No warnings.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable