Bug #54148 [NEW]: substr does not return correct substring
| From: | jrs at bluekiwi-software dot com | Date: | Thu, 03 Mar 2011 11:07:10 +0000 |
| Subject: | Bug #54148 [NEW]: substr does not return correct substring | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-159189@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 7
PHP version: 5.3.5
Package: *Unicode Issues
Bug Type: Bug
Bug description:substr does not return correct substring
Description:
------------
---
From manual page: http://www.php.net/function.mb-substr#Return
Values
---
tested with korean caracters.
Test script:
---------------
header('Content-Type: text/html; charset=UTF-8');
$var = '무ë£ìë² ì´ì©ìì
ëë¤';
var_dump($var);
echo "<br />";
$var = mb_substr($var, 0, 2);
var_dump($var);
Expected result:
----------------
무ë£ìë² ì´ì©ìì
ëë¤
무ë£
Actual result:
--------------
무ë£ìë² ì´ì©ìì
ëë¤
�
--
Edit bug report at http://bugs.php.net/bug.php?id=54148&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54148&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54148&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54148&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54148&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54148&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54148&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54148&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54148&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54148&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54148&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54148&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54148&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54148&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54148&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54148&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54148&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54148&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54148&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54148&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54148&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54148&r=mysqlcfg