Bug #60589 [Opn->Bgs]: str_replace error
| From: | cataphract@php.net | Date: | Thu, 22 Dec 2011 07:12:18 +0000 |
| Subject: | Bug #60589 [Opn->Bgs]: str_replace error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-166038@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60589&edit=1
ID: 60589
Updated by: cataphract@php.net
Reported by: pehohlva at gmail dot com
Summary: str_replace error
-Status: Open
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: lenny debian
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2011-12-22 02:32:26] anon at anon dot anon
str_replace works fine. You're just not using its result. str_replace returns the altered
string; it doesn't change the original. Do:
$item = str_replace(" ", "", $item);
------------------------------------------------------------------------
[2011-12-21 21:07:49] pehohlva at gmail dot com
meant is: str_replace() doesnt recognise ascii 32 as whitespace / space.
------------------------------------------------------------------------
[2011-12-21 21:02:49] pehohlva at gmail dot com
Description:
------------
str_replace() error:
following construct delivers true on using phpexcelreader on ms excelfile as
$item if $item = ord($item)=32
that means, not all whitespaces where found with str_replaces()
Test script:
---------------
foreach($user as $key=>$item)
{
if(trim(str_replace(" ","",$item)) == "")
{
echo"<br>items:".ord($item);
}
}
output will be displayed with ascii 32 (space). Should be not possible.
Expected result:
----------------
dump->NULL
Actual result:
--------------
" " (space ascii 32
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60589&edit=1