ID: 49536 Updated by: moriyo...@php.net Reported By: moriyo...@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] s...@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] moriyo...@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