|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2009-09-11 21:26 UTC] svn@php.net
  [2009-09-23 14:27 UTC] moriyoshi@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 07:00:01 2025 UTC | 
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"