#47150 [Opn->Bgs]: substr() don't work sometimes
| From: | scottmac@php.net | Date: | Mon, 19 Jan 2009 17:12:17 +0000 |
| Subject: | #47150 [Opn->Bgs]: substr() don't work sometimes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-133017@lists.php.net to get a copy of this message | ||
ID: 47150
Updated by: scottmac@php.net
Reported By: info at thierry-roussel dot com
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: Linux 2.6.24.
PHP Version: 5.2.8
New Comment:
Sounds like you're using UTF-8, and substr is designed to work on bytes
rather than whole characters.
Previous Comments:
------------------------------------------------------------------------
[2009-01-19 16:55:52] info at thierry-roussel dot com
Description:
------------
we have a probleme on production server with php 5.2.6
And the server administrator want to update on the 5.2.8 only if this
bug is resolve in this version.
Sometimes, substr don't work and sometimes it does
The bug come only when there ist a specialchar like é or è.
we work in iso.
it is a production server with many client, so the administrator will
not use the cvs version.
Thanks
Reproduce code:
---------------
<?php
echo
htmlentities(substr(html_entity_decode("éabcde"),0,3))."<br>";
?>
Expected result:
----------------
éab
Actual result:
--------------
sometimes : éab
sometimes : éabcde
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47150&edit=1