iliaa           Thu Mar 20 23:25:31 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard       exec.c 
  Log:
  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.1.2.5&r2=1.113.2.3.2.1.2.6&diff_format=u
Index: php-src/ext/standard/exec.c
diff -u php-src/ext/standard/exec.c:1.113.2.3.2.1.2.5 
php-src/ext/standard/exec.c:1.113.2.3.2.1.2.6
--- php-src/ext/standard/exec.c:1.113.2.3.2.1.2.5       Tue Mar 18 00:24:21 2008
+++ php-src/ext/standard/exec.c Thu Mar 20 23:25:31 2008
@@ -16,7 +16,7 @@
    |         Ilia Alshanetsky <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.113.2.3.2.1.2.5 2008/03/18 00:24:21 felipe Exp $ */
+/* $Id: exec.c,v 1.113.2.3.2.1.2.6 2008/03/20 23:25:31 iliaa Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -274,8 +274,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;
                }
 
@@ -356,6 +361,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