Skip to content

Commit 608476f

Browse files
Merge branch '7.3' into 7.4
* 7.3: Fix merge [FrameworkBundle] Clean `http_cache` dir in `KernelTestCase::ensureKernelShutdown()` fix tests on Windows [PropertyInfo] Conflict with phpdocumentor/reflection-docblock >= 6 [Finder] Fix appending empty iterators Fix attributeLoader Bump Symfony version to 7.3.11 Update VERSION for 7.3.10 Update CHANGELOG for 7.3.10 Bump Symfony version to 6.4.33 Update VERSION for 6.4.32 Update CONTRIBUTORS for 6.4.32 Update CHANGELOG for 6.4.32 [Process] Fix escaping for MSYS on Windows
2 parents 626f07a + 81fe4ea commit 608476f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Process.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ private function escapeArgument(?string $argument): string
16471647
if (str_contains($argument, "\0")) {
16481648
$argument = str_replace("\0", '?', $argument);
16491649
}
1650-
if (!preg_match('/[()%!^"<>&|\s]/', $argument)) {
1650+
if (!preg_match('/[()%!^"<>&|\s[\]=;*?\'$]/', $argument)) {
16511651
return $argument;
16521652
}
16531653
$argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);

Tests/ProcessTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,26 @@ public static function provideEscapeArgument()
15161516
yield [1.1];
15171517
}
15181518

1519+
public function testMsysEscapingOnWindows()
1520+
{
1521+
if ('\\' !== \DIRECTORY_SEPARATOR) {
1522+
$this->markTestSkipped('This test is for Windows platform only');
1523+
}
1524+
1525+
file_put_contents('=foo.txt', 'This is a test file.');
1526+
1527+
try {
1528+
$p = $this->getProcess(['type', substr_replace(getcwd(), '=foo.txt', 2)]);
1529+
$p->mustRun();
1530+
1531+
$this->assertSame('This is a test file.', $p->getOutput());
1532+
} finally {
1533+
unlink('=foo.txt');
1534+
}
1535+
1536+
$this->assertSame(\sprintf('type "%s=foo.txt"', substr(getcwd(), 0, 2)), $p->getCommandLine());
1537+
}
1538+
15191539
public function testPreparedCommand()
15201540
{
15211541
$p = Process::fromShellCommandline('echo "${:abc}"DEF');

0 commit comments

Comments
 (0)