From 47374343a192a682701c065751e7c380952b18fe Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 29 May 2024 15:03:59 +0200 Subject: [PATCH] Fix perforce arg not being escaped correctly --- src/Composer/Util/Perforce.php | 2 +- tests/Composer/Test/Util/PerforceTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Util/Perforce.php b/src/Composer/Util/Perforce.php index d8ee9436b..41b76c3b5 100644 --- a/src/Composer/Util/Perforce.php +++ b/src/Composer/Util/Perforce.php @@ -428,7 +428,7 @@ class Perforce public function connectClient() { $p4CreateClientCommand = $this->generateP4Command( - 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec()) + 'client -i < ' . ProcessExecutor::escape($this->getP4ClientSpec()) ); $this->executeCommand($p4CreateClientCommand); } diff --git a/tests/Composer/Test/Util/PerforceTest.php b/tests/Composer/Test/Util/PerforceTest.php index d8743f3d7..8d78eb425 100644 --- a/tests/Composer/Test/Util/PerforceTest.php +++ b/tests/Composer/Test/Util/PerforceTest.php @@ -339,7 +339,7 @@ class PerforceTest extends TestCase public function testConnectClient() { - $expectedCommand = 'p4 -u user -c composer_perforce_TEST_depot -p port client -i < path/composer_perforce_TEST_depot.p4.spec'; + $expectedCommand = 'p4 -u user -c composer_perforce_TEST_depot -p port client -i < '.ProcessExecutor::escape('path/composer_perforce_TEST_depot.p4.spec'); $this->processExecutor->expects($this->at(0)) ->method('execute') ->with($this->equalTo($expectedCommand), $this->equalTo(null))