mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
- [DOC] improve fix for #43261 for % and "
This commit is contained in:
parent
2345321956
commit
e3e8c437ba
2 changed files with 9 additions and 4 deletions
|
@ -272,9 +272,9 @@ PHPAPI char *php_escape_shell_cmd(char *str)
|
|||
}
|
||||
|
||||
switch (str[x]) {
|
||||
#ifndef PHP_WIN32
|
||||
case '"':
|
||||
case '\'':
|
||||
#ifndef PHP_WIN32
|
||||
if (!p && (p = memchr(str + x + 1, str[x], l - x - 1))) {
|
||||
/* noop */
|
||||
} else if (p && *p == str[x]) {
|
||||
|
@ -285,7 +285,9 @@ PHPAPI char *php_escape_shell_cmd(char *str)
|
|||
cmd[y++] = str[x];
|
||||
break;
|
||||
#else
|
||||
/* This is Windows specific for enviromental variables */
|
||||
/* % is Windows specific for enviromental variables, ^%PATH% will
|
||||
output PATH whil ^%PATH^% not. escapeshellcmd will escape all %.
|
||||
*/
|
||||
case '%':
|
||||
cmd[y++] = ' ';
|
||||
break;
|
||||
|
|
|
@ -16,7 +16,8 @@ $data = array(
|
|||
'()[]{}$',
|
||||
'%^',
|
||||
'#&;`|*?',
|
||||
'~<>\\'
|
||||
'~<>\\',
|
||||
'%NOENV%'
|
||||
);
|
||||
|
||||
$count = 1;
|
||||
|
@ -38,9 +39,11 @@ string(6) "^?^<^>"
|
|||
-- Test 4 --
|
||||
string(14) "^(^)^[^]^{^}^$"
|
||||
-- Test 5 --
|
||||
string(2) "^^"
|
||||
string(4) "^%^^"
|
||||
-- Test 6 --
|
||||
string(14) "^#^&^;^`^|^*^?"
|
||||
-- Test 7 --
|
||||
string(8) "^~^<^>^\"
|
||||
-- Test 8 --
|
||||
string(9) "^%NOENV^%"
|
||||
Done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue