]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #26285 (escapeshellarg() uses wrong quotes on windows).
authorIlia Alshanetsky <iliaa@php.net>
Wed, 19 Nov 2003 15:34:36 +0000 (15:34 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 19 Nov 2003 15:34:36 +0000 (15:34 +0000)
NEWS
ext/standard/exec.c

diff --git a/NEWS b/NEWS
index 9f99f4d3a20db0e689fd8774a7ff9b814100d498..b716b525b628e2163f49274b47dfe0972b2c1cfe 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP 4                                                                      NEWS
 ?? ??? 2003, Version 4.3.5
 - Fixed header handler in NSAPI SAPI module (header->replace was ignored,
   send_default_content_type now sends value from php.ini). (Uwe Schindler)
+- Fixed bug #26285 (escapeshellarg() uses wrong quotes on windows). (Ilia)
 - Fixed bug #26267 (gmp_random() leaks memory and does not produce random
   numbers). (Jani)
 - Fixed bug #26253 (ext/tokenizer: build as shared extension fails). (Jani)
index 4fc2a07d39fb6411661451176252717687d064b9..729190f8786195988842a3aaf59106fdee825872 100644 (file)
@@ -462,21 +462,33 @@ char *php_escape_shell_arg(char *str) {
        l = strlen(str);
        
        cmd = emalloc(4 * l + 3); /* worst case */
-       
+#ifdef PHP_WIN32
+       cmd[y++] = '"';
+#else
        cmd[y++] = '\'';
+#endif
        
        for (x = 0; x < l; x++) {
                switch (str[x]) {
+#ifdef PHP_WIN32
+               case '"':
+                       cmd[y++] = '\\';
+#else
                case '\'':
                        cmd[y++] = '\'';
                        cmd[y++] = '\\';
                        cmd[y++] = '\'';
+#endif
                        /* fall-through */
                default:
                        cmd[y++] = str[x];
                }
        }
+#ifdef PHP_WIN32
+       cmd[y++] = '"';
+#else
        cmd[y++] = '\'';
+#endif
        cmd[y] = '\0';
        return cmd;
 }