bug #10429 [2.3][Process] Fix #9160 : escaping an argument with a trailing backslash on windows fails (romainneutron)
This PR was merged into the 2.3 branch.
Discussion
----------
[2.3][Process] Fix #9160 : escaping an argument with a trailing backslash on windows fails
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #9160
| License | MIT
Commits
-------
10e903a
[Process] Fix #9160 : escaping an argument with a trailing backslash on windows fails
This commit is contained in:
commit
0b1b1738df
@ -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