mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-21 22:32:41 +01:00
Fix Subversion "commit" support in PHP 8.1
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. Reviewers: O1 Blessed Committers, aklapper Reviewed By: O1 Blessed Committers, aklapper Subscribers: tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15693 Differential Revision: https://we.phorge.it/D25498
This commit is contained in:
parent
e46025f7a9
commit
6142fcd526
1 changed files with 7 additions and 0 deletions
|
@ -1516,7 +1516,14 @@ abstract class ArcanistWorkflow extends Phobject {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $revision_id
|
||||
* @return string
|
||||
*/
|
||||
final protected function normalizeRevisionID($revision_id) {
|
||||
if ($revision_id === null) {
|
||||
return '';
|
||||
}
|
||||
return preg_replace('/^D/i', '', $revision_id);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue