#49536 [NEW]: mb_detect_encoding() returns incorrect results when strict_mode is turned on
| From: | moriyoshi@php.net | Date: | Fri, 11 Sep 2009 21:23:16 +0000 |
| Subject: | #49536 [NEW]: mb_detect_encoding() returns incorrect results when strict_mode is turned on | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-142267@lists.php.net to get a copy of this message | ||
From: moriyoshi@php.net
Operating system: *
PHP version: 5.3SVN-2009-09-11 (SVN)
PHP Bug Type: mbstring related
Bug description: mb_detect_encoding() returns incorrect results when strict_mode is turned on
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 bug report at http://bugs.php.net/?id=49536&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49536&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49536&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49536&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49536&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49536&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49536&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49536&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49536&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49536&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49536&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49536&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49536&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49536&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49536&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49536&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49536&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49536&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49536&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49536&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49536&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49536&r=mysqlcfg