Skip to content

Commit b5f3aa6

Browse files
Merge branch '7.4' into 8.0
* 7.4: 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.4.5 Update VERSION for 7.4.4 Update CHANGELOG for 7.4.4 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 10df726 + 608476f commit b5f3aa6

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
@@ -1513,6 +1513,26 @@ public static function provideEscapeArgument()
15131513
yield [1.1];
15141514
}
15151515

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

0 commit comments

Comments
 (0)