Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5865f28

Browse filesBrowse files
bug #58752 [Process] Fix escaping /X arguments on Windows (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [Process] Fix escaping /X arguments on Windows | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #58733 | License | MIT Commits ------- 16902ec [Process] Fix escaping /X arguments on Windows
2 parents 97aedb3 + 16902ec commit 5865f28
Copy full SHA for 5865f28

File tree

2 files changed

+7
-2
lines changed
Filter options

2 files changed

+7
-2
lines changed

‎src/Symfony/Component/Process/Process.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Process.php
+1-1Lines 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);

‎src/Symfony/Component/Process/Tests/ProcessTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/Tests/ProcessTest.php
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,12 @@ public function testGetCommandLine()
14241424
{
14251425
$p = new Process(['/usr/bin/php']);
14261426

1427-
$expected = '\\' === \DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
1427+
$expected = '\\' === \DIRECTORY_SEPARATOR ? '/usr/bin/php' : "'/usr/bin/php'";
1428+
$this->assertSame($expected, $p->getCommandLine());
1429+
1430+
$p = new Process(['cd', '/d']);
1431+
1432+
$expected = '\\' === \DIRECTORY_SEPARATOR ? 'cd /d' : "'cd' '/d'";
14281433
$this->assertSame($expected, $p->getCommandLine());
14291434
}
14301435

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.