Skip to content

Commit de681cb

Browse files
committed
[Process] Add tests on ProcessUtils::escapeArgument
1 parent 85fb495 commit de681cb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Symfony/Component/Process/ProcessUtils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ public static function escapeArgument($argument)
5757
$part .= '\\';
5858
}
5959
$part = escapeshellarg($part);
60-
if ($part[0] === '"' && $part[strlen($part) - 1] === '"') {
60+
if ('"' === $part[0] && '"' === $part[strlen($part) - 1]) {
6161
$part = substr($part, 1, -1);
6262
$quote = true;
6363
}
6464
$escapedArgument .= $part;
6565
}
6666
}
6767
if ($quote) {
68-
$escapedArgument = '"' . $escapedArgument . '"';
68+
$escapedArgument = '"'.$escapedArgument.'"';
6969
}
7070

7171
return $escapedArgument;

src/Symfony/Component/Process/Tests/ProcessUtilsTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function dataArguments()
2727
{
2828
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
2929
return array(
30+
array('"\"php\" \"-v\""', '"php" "-v"'),
3031
array('"foo bar"', 'foo bar'),
3132
array('^%"path"^%', '%path%'),
3233
array('"<|>"\\"" "\\""\'f"', '<|>" "\'f'),
@@ -36,6 +37,7 @@ public function dataArguments()
3637
}
3738

3839
return array(
40+
array("'\"php\" \"-v\"'", '"php" "-v"'),
3941
array("'foo bar'", 'foo bar'),
4042
array("'%path%'", '%path%'),
4143
array("'<|>\" \"'\\''f'", '<|>" "\'f'),

0 commit comments

Comments
 (0)