#28048 [Opn->Bgs]: using str_replace() together with while chaches PHP
| From: | derick@php.net | Date: | Sun, 18 Apr 2004 14:45:37 +0000 |
| Subject: | #28048 [Opn->Bgs]: using str_replace() together with while chaches PHP | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58334@lists.php.net to get a copy of this message | ||
ID: 28048
Updated by: derick@php.net
Reported By: johan at braattha dot se
-Status: Open
+Status: Bogus
Bug Type: Reproducible crash
Operating System: windows2000
PHP Version: 4.3.4
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP --
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
Try 4.3.6 first.
Previous Comments:
------------------------------------------------------------------------
[2004-04-18 16:12:49] johan at braattha dot se
Description:
------------
When using str_replace() in a way it might not be thought (inside a
while-loop where the statement is the actual str_replace one...) for
(but still a valid one) it crashes php. This is 4 lines of code...
It just takes a while (less than a minute for me) before php actually
crashes. I have not seen any updates on this bug in 4.3.5 or 4.3.6...
Reproduce code:
---------------
$string="I hate double spaces.";
while ($string=str_replace(" "," ",$string)) {
$string=str_replace(" "," ",$string);
}
Expected result:
----------------
I expected $string to be: "I hate double spaces." I did not realise
that str_replace() did this without the while loop... So everything
works like a charm for me, but it might be problematic for other
people?
Actual result:
--------------
A chrash... it takes a while and then apache restarts...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28048&edit=1