diff --git a/src/Composer/Util/ProcessExecutor.php b/src/Composer/Util/ProcessExecutor.php index 16352bbcf..ca181d7d3 100644 --- a/src/Composer/Util/ProcessExecutor.php +++ b/src/Composer/Util/ProcessExecutor.php @@ -490,7 +490,8 @@ class ProcessExecutor // New lines break cmd.exe command parsing $argument = strtr($argument, "\n", ' '); - $quote = strpbrk($argument, " \t") !== false; + // In addition to whitespace, commas need quoting to preserve paths + $quote = strpbrk($argument, " \t,") !== false; $argument = Preg::replace('/(\\\\*)"/', '$1$1\\"', $argument, -1, $dquotes); $meta = $dquotes || Preg::isMatch('/%[^%]+%|![^!]+!/', $argument); diff --git a/tests/Composer/Test/Util/ProcessExecutorTest.php b/tests/Composer/Test/Util/ProcessExecutorTest.php index ff2acd82e..13bf31cbc 100644 --- a/tests/Composer/Test/Util/ProcessExecutorTest.php +++ b/tests/Composer/Test/Util/ProcessExecutorTest.php @@ -178,6 +178,9 @@ class ProcessExecutorTest extends TestCase // no whitespace must not be quoted 'no-ws' => array('abc', 'abc', "'abc'"), + // commas must be quoted + 'comma' => array('a,bc', '"a,bc"', "'a,bc'"), + // double-quotes must be backslash-escaped 'dq' => array('a"bc', 'a\^"bc', "'a\"bc'"),