Skip to content

Commit 81fe4ea

Browse files
Merge branch '6.4' into 7.3
* 6.4: fix tests on Windows [PropertyInfo] Conflict with phpdocumentor/reflection-docblock >= 6 [Finder] Fix appending empty iterators Fix attributeLoader 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 4424bc1 + c46e854 commit 81fe4ea

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
@@ -1638,7 +1638,7 @@ private function escapeArgument(?string $argument): string
16381638
if (str_contains($argument, "\0")) {
16391639
$argument = str_replace("\0", '?', $argument);
16401640
}
1641-
if (!preg_match('/[()%!^"<>&|\s]/', $argument)) {
1641+
if (!preg_match('/[()%!^"<>&|\s[\]=;*?\'$]/', $argument)) {
16421642
return $argument;
16431643
}
16441644
$argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);

Tests/ProcessTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,26 @@ public static function provideEscapeArgument()
15471547
yield [1.1];
15481548
}
15491549

1550+
public function testMsysEscapingOnWindows()
1551+
{
1552+
if ('\\' !== \DIRECTORY_SEPARATOR) {
1553+
$this->markTestSkipped('This test is for Windows platform only');
1554+
}
1555+
1556+
file_put_contents('=foo.txt', 'This is a test file.');
1557+
1558+
try {
1559+
$p = $this->getProcess(['type', substr_replace(getcwd(), '=foo.txt', 2)]);
1560+
$p->mustRun();
1561+
1562+
$this->assertSame('This is a test file.', $p->getOutput());
1563+
} finally {
1564+
unlink('=foo.txt');
1565+
}
1566+
1567+
$this->assertSame(\sprintf('type "%s=foo.txt"', substr(getcwd(), 0, 2)), $p->getCommandLine());
1568+
}
1569+
15501570
public function testPreparedCommand()
15511571
{
15521572
$p = Process::fromShellCommandline('echo "${:abc}"DEF');

0 commit comments

Comments
 (0)