iliaa           Wed Nov 19 10:34:38 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src    NEWS 
    /php-src/ext/standard       exec.c 
  Log:
  MFH: Fixed bug #26285 (escapeshellarg() uses wrong quotes on windows).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.472 php-src/NEWS:1.1247.2.473
--- php-src/NEWS:1.1247.2.472   Tue Nov 18 23:44:23 2003
+++ php-src/NEWS        Wed Nov 19 10:34:35 2003
@@ -3,6 +3,7 @@
 ?? ??? 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: php-src/ext/standard/exec.c
diff -u php-src/ext/standard/exec.c:1.84.2.12 php-src/ext/standard/exec.c:1.84.2.13
--- php-src/ext/standard/exec.c:1.84.2.12       Thu Aug 28 11:54:35 2003
+++ php-src/ext/standard/exec.c Wed Nov 19 10:34:36 2003
@@ -15,7 +15,7 @@
    | Author: Rasmus Lerdorf                                               |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.84.2.12 2003/08/28 15:54:35 sas Exp $ */
+/* $Id: exec.c,v 1.84.2.13 2003/11/19 15:34:36 iliaa Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -462,21 +462,33 @@
        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;
 }

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

Reply via email to