]> granicus.if.org Git - php/commitdiff
- MFH: Fix bug #45239 (encoding detector hangs with mbstring.strict_detection
authorMoriyoshi Koizumi <moriyoshi@php.net>
Fri, 6 Feb 2009 08:49:05 +0000 (08:49 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Fri, 6 Feb 2009 08:49:05 +0000 (08:49 +0000)
  enabled).

NEWS
ext/mbstring/libmbfl/mbfl/mbfilter.c
ext/mbstring/tests/bug45239.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index c9b00f47780648089ebfd57a38b78d9cabc6faff..f432c8aa210a3753b12306288f9a4d74038b073f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -56,7 +56,8 @@ PHP                                                                        NEWS
 - Fixed bug #46887 (Invalid calls to php_error_docref()).
   (oeriksson at mandriva dot com, Ilia)
 - Fixed bug #46873 (extract($foo) crashes if $foo['foo'] exists). (Arnaud)
-- Fixed bug #46843 (CP936 euro symbol is not converted properly). (Moriyoshi)
+- Fixed bug #46843 (CP936 euro symbol is not converted properly).
+  (ty_c at cybozuy dot co dot jp, Moriyoshi)
 - Fixed bug #46798 (Crash in mssql extension when retrieving a NULL value
   inside a binary or image column type). (Ilia)
 - Fixed bug #46782 (fastcgi.c parse error). (Matt)
@@ -74,6 +75,8 @@ PHP                                                                        NEWS
   (admorten at umich dot edu, Stas)
 - Fixed bug #45996 (libxml2 2.7 causes breakage with character data 
   in xml_parse()). (Rob)
+- Fixed bug #45239 (Encoding detector hangs with mbstring.strict_detection
+  enabled). (Moriyoshi)
 - Fixed bug #45161 (Reusing a curl handle leaks memory). (Mark Karpeles, Jani)
 - Fixed bug #44336 (Improve pcre UTF-8 string matching performance).
   (frode at coretrek dot com, Nuno)
index 50a0853665a5f482a08959b80170f00ee71c3d60..a2c117d2a300dd36a5d2d9714d0af9afa2d0c75b 100644 (file)
@@ -462,10 +462,9 @@ enum mbfl_no_encoding mbfl_encoding_detector_judge(mbfl_encoding_detector *ident
                while (n >= 0) {
                        filter = identd->filter_list[n];
                        if (!filter->flag) {
-                               if (identd->strict && filter->status) {
-                                       continue;
+                               if (!identd->strict || !filter->status) {
+                                       encoding = filter->encoding->no_encoding;
                                }
-                               encoding = filter->encoding->no_encoding;
                        }
                        n--;
                }
diff --git a/ext/mbstring/tests/bug45239.phpt b/ext/mbstring/tests/bug45239.phpt
new file mode 100644 (file)
index 0000000..8d8ef48
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Bug #45239 (encoding detector hangs with mbstring.strict_detection enabled)
+--INI--
+mbstring.strict_detection=1
+mbstring.http_input=UTF-8
+mbstring.internal_encoding=UTF-8
+--SKIPIF--
+<?php
+extension_loaded('mbstring') or die('skip');
+?>
+--FILE--
+<?php
+mb_internal_encoding("utf-8");
+mb_parse_str("a=%fc", $dummy);
+var_dump(mb_http_input());
+?>
+--EXPECT--
+string(5) "UTF-8"