]> granicus.if.org Git - php/commitdiff
- [DOC] improve fix for #43261 for % and "
authorPierre Joye <pajoye@php.net>
Sun, 17 Aug 2008 15:23:23 +0000 (15:23 +0000)
committerPierre Joye <pajoye@php.net>
Sun, 17 Aug 2008 15:23:23 +0000 (15:23 +0000)
ext/standard/exec.c
ext/standard/tests/general_functions/escapeshellcmd-win32.phpt

index b22e6a3da9178c68467d8eeb19b4c02a7b3d091c..fb3ab0770d7111c582eb6adb898d12d217cc0cbe 100644 (file)
@@ -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;
index 3da43e15f70ae4c6d34f036e380676d9ec9d1e0c..9fcb99188c2b7e2ab6f3f1a788c80ae07dcc029b 100644 (file)
@@ -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