[Process] Fix #9160 : escaping an argument with a trailing backslash on windows fails
This commit is contained in:
parent
2c55a2dafc
commit
10e903aa5d
@ -52,6 +52,9 @@ class ProcessUtils
|
||||
} elseif ('%' === $part) {
|
||||
$escapedArgument .= '^%';
|
||||
} else {
|
||||
if ('\\' === substr($part, -1)) {
|
||||
$part .= '\\';
|
||||
}
|
||||
$escapedArgument .= escapeshellarg($part);
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ class ProcessUtilsTest extends \PHPUnit_Framework_TestCase
|
||||
array('^%"path"^%', '%path%'),
|
||||
array('"<|>"\\"" "\\""\'f"', '<|>" "\'f'),
|
||||
array('""', ''),
|
||||
array('"with\trailingbs\\\\"', 'with\trailingbs\\'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -39,6 +40,7 @@ class ProcessUtilsTest extends \PHPUnit_Framework_TestCase
|
||||
array("'%path%'", '%path%'),
|
||||
array("'<|>\" \"'\\''f'", '<|>" "\'f'),
|
||||
array("''", ''),
|
||||
array("'with\\trailingbs\\'", 'with\trailingbs\\'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user