From c78ddab607a1bb7307b2ab02b73cc642cfdff232 Mon Sep 17 00:00:00 2001 From: Adam G-H <32250-phenaproxima@users.noreply.drupalcode.org> Date: Thu, 12 Oct 2023 14:02:25 +0000 Subject: [PATCH] Issue #3393633: Build tests can fail randomly if the stage ID begins with a - --- src/ConsoleUpdateStage.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ConsoleUpdateStage.php b/src/ConsoleUpdateStage.php index 071c115cc1..7e2f09b523 100644 --- a/src/ConsoleUpdateStage.php +++ b/src/ConsoleUpdateStage.php @@ -262,7 +262,11 @@ class ConsoleUpdateStage extends UpdateStage { * The ID of the current stage. */ protected function triggerPostApply(string $stage_id): void { - $arguments = "post-apply $stage_id"; + // The stage ID needs to be quoted in order to prevent it from being parsed + // as a command-line option if it begins with -, which is a possibility + // because we use \Drupal\Component\Utility\Crypt::randomBytesBase64() to + // generate the stage ID, and the string it returns might begin with -. + $arguments = sprintf('post-apply "%s"', $stage_id); if ($this->isFromWeb) { $arguments .= ' --is-from-web'; } -- GitLab