|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45182 substr UTF-8 character problem
Submitted: 2008-06-04 19:16 UTC Modified: 2008-06-05 16:05 UTC
From: bahadir at eggdrop dot gen dot tr Assigned:
Status: Not a bug Package: *Unicode Issues
PHP Version: 5.2.6 OS: Windows XP
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: bahadir at eggdrop dot gen dot tr
New email:
PHP Version: OS:


 [2008-06-04 19:16 UTC] bahadir at eggdrop dot gen dot tr
Hi there,

I have this function ...

If character start with > ?

Problem this:

Actual result: ?. Bahadir Kocaoglu

Expected result: ?. Bahadir Kocaoglu

Original string: ?mit Bahadir Kocaoglu

Reproduce code:
function showMemberName($id) {
	$SQL = mysql_query(sprintf("SELECT `username`, `name` FROM `members` WHERE `id` = '%d';", $id));
	$Member = mysql_fetch_array($SQL);
	if ($Member[0]) {
		return $Member[0];
	} else {
		return substr($Member[1], 0, 1).'. '.strstr($Member[1], " ");

echo showMemberName(1);

Expected result:
?. Bahadir Kocaoglu

Actual result:
?. Bahadir Kocaoglu


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-05 16:05 UTC]
Unicode support comes with PHP 6. Use mbstring for now.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 17:01:31 2024 UTC