php.net |  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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
Description:
------------
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], " ");
	}
	mysql_free_result($SQL);
}

echo showMemberName(1);
?>


Expected result:
----------------
?. Bahadir Kocaoglu


Actual result:
--------------
?. Bahadir Kocaoglu


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-05 16:05 UTC] jani@php.net
Unicode support comes with PHP 6. Use mbstring for now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC