Bug #54494 [Opn->Csd]: mb_substr() fails on "UTF-32LE"
| From: | cataphract@php.net | Date: | Sat, 09 Apr 2011 16:59:58 +0000 |
| Subject: | Bug #54494 [Opn->Csd]: mb_substr() fails on "UTF-32LE" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160073@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54494&edit=1
ID: 54494
Updated by: cataphract@php.net
Reported by: rodney dot rehm at medialize dot de
Summary: mb_substr() fails on "UTF-32LE"
-Status: Open
+Status: Closed
Type: Bug
Package: mbstring related
Operating System: Mac OS X 10.6.7 / Windows 2003
PHP Version: 5.3.6
-Assigned To:
+Assigned To: cataphract
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2011-04-09 18:59:38] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&revision=310108
Log: - Fixed bug #54494: mb_substr() mishandles UTF-32LE and UCS-2LE.
------------------------------------------------------------------------
[2011-04-08 17:05:56] rodney dot rehm at medialize dot de
Description:
------------
Iterating the characters of a UTF-32LE encoded string by using
mb_substr() fails. Same string UTF-32BE encoded works as expected.
Test script:
---------------
<?php
declare(encoding = 'UTF-8');
mb_internal_encoding('UTF-8');
header('Content-Type: text/plain; charset=UTF-32LE');
$string = "hällö wörld\n";
$string = mb_convert_encoding($string, "UTF-32LE");
$length = mb_strlen($string, "UTF-32LE");
echo mb_convert_encoding("Length: ". $length ."\n", "UTF-32LE");
echo $string;
for ($i=0; $i < $length; $i++) {
echo mb_substr($string, $i, 1, "UTF-32LE");
}
?>
Expected result:
----------------
Length: 12
hällö wörld
hällö wörld
Actual result:
--------------
Length: 12
hällö wörld
häl
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54494&edit=1