Bug #11448: str_replace
| From: | a2zofciv2 at hotmail dot com | Date: | Tue, 12 Jun 2001 23:07:10 +0000 |
| Subject: | Bug #11448: str_replace | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-56737@lists.php.net to get a copy of this message | ||
From: a2zofciv2@hotmail.com
Operating system: cobalt linux
PHP version: 4.0.5
PHP Bug Type: Unknown/Other Function
Bug description: str_replace
the following line:
$line = str_replace("pattern", Pattern(),$line);
where Pattern() is a function that returns a string.
Pattern executes everytime this code line is encountered, even if "pattern" is not a match
on $line.
so if i loop through a file running that line, the function Pattern() will execute every single
time, match or no match.
(my) common sense says this function should only execute when a match is found. Is this a bug? I
didn't know about it and something like this could seriously affect performance of a program.
Also I don't think the modules or any other of your requirements are relevant for this issue.
--
Edit Bug report at: http://bugs.php.net/?id=11448&edit=1