[Process] Fix #9160 : escaping an argument with a trailing backslash on windows fails

This commit is contained in:
Romain Neutron 2014-03-12 15:41:28 +01:00
parent 2c55a2dafc
commit 10e903aa5d
2 changed files with 5 additions and 0 deletions

View File

@ -52,6 +52,9 @@ class ProcessUtils
} elseif ('%' === $part) {
$escapedArgument .= '^%';
} else {
if ('\\' === substr($part, -1)) {
$part .= '\\';
}
$escapedArgument .= escapeshellarg($part);
}
}

View File

@ -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\\'),
);
}
}