#23268 [Opn->Fbk]: str_replace total system overload
| From: | pollita@php.net | Date: | Fri, 18 Apr 2003 22:21:05 +0000 |
| Subject: | #23268 [Opn->Fbk]: str_replace total system overload | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-37872@lists.php.net to get a copy of this message | ||
ID: 23268
Updated by: pollita@php.net
Reported By: nick at netdupe dot com
-Status: Open
+Status: Feedback
Bug Type: Performance problem
Operating System: Linux
PHP Version: 4.3.1
New Comment:
Significant portions of the str_replace function are rewritten in the
development branch. Can you try downloading a snapshot of PHP-5.0-dev
and seeing if the problem persists? I'd also like to ask you to try
the latest snapshot of the stable branch. PHP-4.3-stable
http://snaps.php.net
And incidently your first example shouldn't come up with any error, it
should simply fail to replace anything (str_replace is case-sensitive)
Previous Comments:
------------------------------------------------------------------------
[2003-04-18 17:07:56] nick at netdupe dot com
ok this is the code i used it with:
<?
$file = file("smillies.db");
foreach($file as $value){
list($rand,$code,$image) = explode("|<|",
$value);
$code = stripslashes($code);
$fusnewsm = str_replace("$code","<img
src=\"http://images.devdino.com/smillies/$image\"
border=\"0\">",$fusnewsm );
}
?>
You will need smilies.db you can get it from
www.devdino.com/smillies.db.
------------------------------------------------------------------------
[2003-04-18 09:40:03] magnus@php.net
I could not reproduce it with exactly that code.
Tried both 4.3.0 and current PHP_4_3 branch.
------------------------------------------------------------------------
[2003-04-18 06:33:06] nick at netdupe dot com
got a little mistake in there, "shoudnt it come up?"
should be "shoudnt it come up with an error?"
------------------------------------------------------------------------
[2003-04-18 06:31:38] nick at netdupe dot com
If you accidently put something like the following in
str_replace the server goes nuts and does not return
any information.
<?
$code = "hello";
$string = "Hello, Bob how are you";
$text = str_replace("$code", "hey", $string);
?>
This only occurs when you put $code in quotation marks.
Shouldnt it come up? I did this the server load went
from 0.05 to 23.4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23268&edit=1