Fix cmd splitting paths on commas (#10775)
parent
aeb204bb1d
commit
2837585e47
|
@ -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);
|
||||
|
||||
|
|
|
@ -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'"),
|
||||
|
||||
|
|
Loading…
Reference in New Issue