#49536 [Opn->Asn]: mb_detect_encoding() returns incorrect results when strict_mode is turned on
| From: | moriyoshi@php.net | Date: | Fri, 11 Sep 2009 21:26:28 +0000 |
| Subject: | #49536 [Opn->Asn]: mb_detect_encoding() returns incorrect results when strict_mode is turned on | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-142268@lists.php.net to get a copy of this message | ||
ID: 49536
Updated by: moriyoshi@php.net
Reported By: moriyoshi@php.net
-Status: Open
+Status: Assigned
Bug Type: mbstring related
Operating System: *
PHP Version: 5.3SVN-2009-09-11 (SVN)
Assigned To: moriyoshi
Previous Comments:
------------------------------------------------------------------------
[2009-09-11 21:26:18] svn@php.net
Automatic comment from SVN on behalf of moriyoshi
Revision: http://svn.php.net/viewvc/?view=revision&revision=288273
Log: - Fix bug #49536 (mb_detect_encoding() returns incorrect results
when strict_mode is turned on.)
(patch by komura, thanks!)
------------------------------------------------------------------------
[2009-09-11 21:23:16] moriyoshi@php.net
Description:
------------
mb_detect_encoding() produces wrong results from incomplete multibyte
sequences when strict_mode is turned on. (originally reported by
komura.db2r1e|at|gmail|dot|com)
Reproduce code:
---------------
// non-strict mode
var_dump(mb_detect_encoding("A\x81", "SJIS", false));
// strict mode
var_dump(mb_detect_encoding("A\x81", "SJIS", true));
// non-strict mode
var_dump(mb_detect_encoding("\xc0\x00", "UTF-8", false));
// strict mode
var_dump(mb_detect_encoding("\xc0\x00", "UTF-8", true));
Expected result:
----------------
string(4) "SJIS"
bool(false)
string(5) "UTF-8"
bool(false)
Actual result:
--------------
string(4) "SJIS"
string(4) "SJIS"
string(5) "UTF-8"
string(5) "UTF-8"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49536&edit=1