hirokawa                Fri Nov  3 02:26:50 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/mbstring       mb_gpc.c mbstring.c 
  Log:
  fixed illegal encoding detection when mbstring.encoding_translation is 
enabled.(made by komura)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mb_gpc.c?r1=1.17.2.2&r2=1.17.2.2.2.1&diff_format=u
Index: php-src/ext/mbstring/mb_gpc.c
diff -u php-src/ext/mbstring/mb_gpc.c:1.17.2.2 
php-src/ext/mbstring/mb_gpc.c:1.17.2.2.2.1
--- php-src/ext/mbstring/mb_gpc.c:1.17.2.2      Sun Jan  1 12:50:08 2006
+++ php-src/ext/mbstring/mb_gpc.c       Fri Nov  3 02:26:50 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: mb_gpc.c,v 1.17.2.2 2006/01/01 12:50:08 sniper Exp $ */
+/* $Id: mb_gpc.c,v 1.17.2.2.2.1 2006/11/03 02:26:50 hirokawa Exp $ */
 
 /* {{{ includes */
 #ifdef HAVE_CONFIG_H
@@ -154,6 +154,8 @@
        info.num_from_encodings     = MBSTRG(http_input_list_size); 
        info.from_language          = MBSTRG(language);
 
+       MBSTRG(illegalchars) = 0;
+
        detected = _php_mb_encoding_handler_ex(&info, array_ptr, res TSRMLS_CC);
        MBSTRG(http_input_identify) = detected;
 
@@ -346,6 +348,7 @@
        }
 
        if (convd != NULL) {
+               MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd);
                mbfl_buffer_converter_delete(convd);
        }
        if (val_list != NULL) {
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.15&r2=1.224.2.22.2.16&diff_format=u
Index: php-src/ext/mbstring/mbstring.c
diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.15 
php-src/ext/mbstring/mbstring.c:1.224.2.22.2.16
--- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.15     Sun Sep 24 07:10:54 2006
+++ php-src/ext/mbstring/mbstring.c     Fri Nov  3 02:26:50 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: mbstring.c,v 1.224.2.22.2.15 2006/09/24 07:10:54 hirokawa Exp $ */
+/* $Id: mbstring.c,v 1.224.2.22.2.16 2006/11/03 02:26:50 hirokawa Exp $ */
 
 /*
  * PHP 4 Multibyte String module "mbstring"
@@ -933,7 +933,10 @@
        MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding);
        MBSTRG(current_filter_illegal_mode) = MBSTRG(filter_illegal_mode);
        MBSTRG(current_filter_illegal_substchar) = 
MBSTRG(filter_illegal_substchar);
-       MBSTRG(illegalchars) = 0;
+
+       if (!MBSTRG(encoding_translation)) {
+               MBSTRG(illegalchars) = 0;
+       }
 
        n = 0;
        if (MBSTRG(detect_order_list)) {
@@ -4053,8 +4056,13 @@
 
        if (ret != NULL) {
                MBSTRG(illegalchars) += illegalchars;
-               efree(ret->val);
-               RETURN_BOOL(illegalchars == 0);
+               if (illegalchars == 0 && strncmp(string.val, ret->val, 
string.len) == 0) {
+                       efree(ret->val);
+                       RETURN_TRUE;
+               } else {
+                       efree(ret->val);
+                       RETURN_FALSE;
+               }
        } else {
                RETURN_FALSE;
        }

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

Reply via email to