iliaa           Thu Mar 20 23:25:42 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/standard       exec.c 
  Log:
  
  MFB: Refine fix for multibyte char hanling inside command names and args
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.113.2.3.2.6&r2=1.113.2.3.2.7&diff_format=u
Index: php-src/ext/standard/exec.c
diff -u php-src/ext/standard/exec.c:1.113.2.3.2.6 
php-src/ext/standard/exec.c:1.113.2.3.2.7
--- php-src/ext/standard/exec.c:1.113.2.3.2.6   Tue Mar 18 00:25:24 2008
+++ php-src/ext/standard/exec.c Thu Mar 20 23:25:42 2008
@@ -16,7 +16,7 @@
    |         Ilia Alshanetsky <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.113.2.3.2.6 2008/03/18 00:25:24 felipe Exp $ */
+/* $Id: exec.c,v 1.113.2.3.2.7 2008/03/20 23:25:42 iliaa Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -273,8 +273,13 @@
        cmd = safe_emalloc(2, l, 1);
        
        for (x = 0, y = 0; x < l; x++) {
+               int mb_len = php_mblen(str + x, (l - x));
+
                /* skip non-valid multibyte characters */
-               if (php_mblen(str + x, (l - x)) < 0) {
+               if (mb_len < 0) {
+                       continue;
+               } else if (mb_len > 1) {
+                       x += mb_len - 1;
                        continue;
                }
 
@@ -349,6 +354,16 @@
 #endif
 
        for (x = 0; x < l; x++) {
+               int mb_len = php_mblen(str + x, (l - x));
+
+               /* skip non-valid multibyte characters */
+               if (mb_len < 0) {
+                       continue;
+               } else if (mb_len > 1) {
+                       x += mb_len - 1;
+                       continue;
+               }
+
                switch (str[x]) {
 #ifdef PHP_WIN32
                case '"':



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

Reply via email to