|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54148 substr does not return correct substring
Submitted: 2011-03-03 12:07 UTC Modified: 2011-03-03 13:20 UTC
From: jrs at bluekiwi-software dot com Assigned:
Status: Not a bug Package: *Unicode Issues
PHP Version: 5.3.5 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jrs at bluekiwi-software dot com
New email:
PHP Version: OS:


 [2011-03-03 12:07 UTC] jrs at bluekiwi-software dot com
From manual page: Values

tested with korean caracters.

Test script:
header('Content-Type: text/html; charset=UTF-8');
$var = '무료서버 이용자입니다';
echo "<br />";
$var = mb_substr($var, 0, 2);

Expected result:
무료서버 이용자입니다

Actual result:
무료서버 이용자입니다


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-03 13:20 UTC]
-Status: Open +Status: Bogus
 [2011-03-03 13:20 UTC]
david@copenhagen:~/test$ /home/david/dev/php/php53/sapi/cli/php -v
PHP 5.3.6-dev (cli) (built: Feb 26 2011 23:29:38) (DEBUG)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
david@copenhagen:~/test$ /home/david/dev/php/php53/sapi/cli/php t.php 
string(31) "무료서버 이용자입니다"
string(6) "무료"
david@copenhagen:~/test$ cat t.php 

$var = '무료서버 이용자입니다';
$var = mb_substr($var, 0, 2, 'utf-8');

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 23 12:01:32 2024 UTC