felipe          Sun Mar 30 12:27:37 2008 UTC

  Modified files:              
    /php-src/ext/standard       exec.c 
    /php-src/sapi/cli/tests     bug44564.phpt 
  Log:
  MFB: Fixed bug #44564 (escapeshellarg removes UTF-8 multi-byte characters)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.131&r2=1.132&diff_format=u
Index: php-src/ext/standard/exec.c
diff -u php-src/ext/standard/exec.c:1.131 php-src/ext/standard/exec.c:1.132
--- php-src/ext/standard/exec.c:1.131   Sat Mar 22 20:37:08 2008
+++ php-src/ext/standard/exec.c Sun Mar 30 12:27:37 2008
@@ -16,7 +16,7 @@
    |         Ilia Alshanetsky <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.131 2008/03/22 20:37:08 felipe Exp $ */
+/* $Id: exec.c,v 1.132 2008/03/30 12:27:37 felipe Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -265,6 +265,8 @@
                if (mb_len < 0) {
                        continue;
                } else if (mb_len > 1) {
+                       memcpy(cmd + y, str + x, mb_len);
+                       y += mb_len;
                        x += mb_len - 1;
                        continue;
                }
@@ -353,6 +355,8 @@
                if (mb_len < 0) {
                        continue;
                } else if (mb_len > 1) {
+                       memcpy(cmd + y, str + x, mb_len);
+                       y += mb_len;
                        x += mb_len - 1;
                        continue;
                }
http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/tests/bug44564.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/sapi/cli/tests/bug44564.phpt
diff -u /dev/null php-src/sapi/cli/tests/bug44564.phpt:1.2
--- /dev/null   Sun Mar 30 12:27:37 2008
+++ php-src/sapi/cli/tests/bug44564.phpt        Sun Mar 30 12:27:37 2008
@@ -0,0 +1,16 @@
+--TEST--
+Bug #44564 (escapeshellarg removes UTF-8 multi-byte characters)
+--FILE--
+<?php
+
+var_dump(escapeshellcmd('f{o}<€>'));
+var_dump(escapeshellarg('f~|;*Þ?'));
+var_dump(escapeshellcmd('?€®đæ?'));
+var_dump(escapeshellarg('aŊł€'));
+
+?>
+--EXPECT--
+string(13) "f\{o\}\<€\>"
+string(10) "'f~|;*Þ?'"
+string(13) "\?€®đæ\?"
+string(10) "'aŊł€'"



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

Reply via email to