iliaa           Tue May 18 09:43:25 2004 EDT

  Modified files:              
    /php-src/ext/standard       exec.c 
  Log:
  Fixed command line escaping routines for win32.
   
  
http://cvs.php.net/diff.php/php-src/ext/standard/exec.c?r1=1.109&r2=1.110&ty=u
Index: php-src/ext/standard/exec.c
diff -u php-src/ext/standard/exec.c:1.109 php-src/ext/standard/exec.c:1.110
--- php-src/ext/standard/exec.c:1.109   Wed Jan 21 11:57:13 2004
+++ php-src/ext/standard/exec.c Tue May 18 09:43:24 2004
@@ -16,7 +16,7 @@
    |         Ilia Alshanetsky <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.109 2004/01/21 16:57:13 iliaa Exp $ */
+/* $Id: exec.c,v 1.110 2004/05/18 13:43:24 iliaa Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -269,6 +269,7 @@
                switch (str[x]) {
                        case '"':
                        case '\'':
+#ifndef PHP_WIN32
                                if (!p && (p = memchr(str + x + 1, str[x], l - x - 
1))) {
                                        /* noop */
                                } else if (p && *p == str[x]) {
@@ -278,6 +279,7 @@
                                }
                                cmd[y++] = str[x];
                                break;
+#endif
                        case '#': /* This is character-set independent */
                        case '&':
                        case ';':
@@ -299,6 +301,12 @@
                        case '\\':
                        case '\x0A': /* excluding these two */
                        case '\xFF':
+#ifdef PHP_WIN32
+                       /* since Windows does not allow us to escape these chars, just 
remove them */
+                       case '%':
+                               cmd[y++] = ' ';
+                               break;
+#endif
                                cmd[y++] = '\\';
                                /* fall-through */
                        default:
@@ -332,7 +340,9 @@
                switch (str[x]) {
 #ifdef PHP_WIN32
                case '"':
-                       cmd[y++] = '\\';
+               case '%':
+                       cmd[y++] = ' ';
+                       break;
 #else
                case '\'':
                        cmd[y++] = '\'';

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to