- [DOC] improve fix for #43261 for % and "

This commit is contained in:
Pierre Joye 2008-08-17 15:23:23 +00:00
parent 2345321956
commit e3e8c437ba
2 changed files with 9 additions and 4 deletions

View file

@ -272,9 +272,9 @@ PHPAPI char *php_escape_shell_cmd(char *str)
} }
switch (str[x]) { switch (str[x]) {
#ifndef PHP_WIN32
case '"': case '"':
case '\'': case '\'':
#ifndef PHP_WIN32
if (!p && (p = memchr(str + x + 1, str[x], l - x - 1))) { if (!p && (p = memchr(str + x + 1, str[x], l - x - 1))) {
/* noop */ /* noop */
} else if (p && *p == str[x]) { } else if (p && *p == str[x]) {
@ -285,7 +285,9 @@ PHPAPI char *php_escape_shell_cmd(char *str)
cmd[y++] = str[x]; cmd[y++] = str[x];
break; break;
#else #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 '%': case '%':
cmd[y++] = ' '; cmd[y++] = ' ';
break; break;

View file

@ -16,7 +16,8 @@ $data = array(
'()[]{}$', '()[]{}$',
'%^', '%^',
'#&;`|*?', '#&;`|*?',
'~<>\\' '~<>\\',
'%NOENV%'
); );
$count = 1; $count = 1;
@ -38,9 +39,11 @@ string(6) "^?^<^>"
-- Test 4 -- -- Test 4 --
string(14) "^(^)^[^]^{^}^$" string(14) "^(^)^[^]^{^}^$"
-- Test 5 -- -- Test 5 --
string(2) "^^" string(4) "^%^^"
-- Test 6 -- -- Test 6 --
string(14) "^#^&^;^`^|^*^?" string(14) "^#^&^;^`^|^*^?"
-- Test 7 -- -- Test 7 --
string(8) "^~^<^>^\" string(8) "^~^<^>^\"
-- Test 8 --
string(9) "^%NOENV^%"
Done Done