iliaa           Thu Mar 20 23:26:01 2008 UTC

  Modified files:              
    /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.128&r2=1.129&diff_format=u
Index: php-src/ext/standard/exec.c
diff -u php-src/ext/standard/exec.c:1.128 php-src/ext/standard/exec.c:1.129
--- php-src/ext/standard/exec.c:1.128   Tue Mar 18 00:32:58 2008
+++ php-src/ext/standard/exec.c Thu Mar 20 23:26:01 2008
@@ -16,7 +16,7 @@
    |         Ilia Alshanetsky <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.128 2008/03/18 00:32:58 felipe Exp $ */
+/* $Id: exec.c,v 1.129 2008/03/20 23:26:01 iliaa Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -259,8 +259,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;
                }
 
@@ -341,6 +346,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