ID:               22141
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Mac OS 10.2
 PHP Version:      4.2.3
 New Comment:

This has already been fixed in CVS.  PHP's internals contain two
str_replace methods, the fourth parameter (when set to a non-zero
value) uses the alternate search and replace method.  

It's not documented because the alternate method was not endoresed for
use.  As of 4.3.1 (which is yet to be released, you can use a snapshot
from snaps.php.net in the mean time), the alternate method has been
removed (and the existing method improved for speed and efficiency.


Previous Comments:
------------------------------------------------------------------------

[2003-02-09 15:15:34] [EMAIL PROTECTED]

I was inadvertently including a fourth argument of "-1" 
with some instances of str_replace() -- since I got into 
the habit of the limit arg using preg_replace() -- and I 
noticed an odd behavior:

str_replace("-embed-a-", "hey", "-embed-a-", -1) returns 
"hey," as expected.

str_replace("-embed-a-", "hey", "-embed-b-", -1) returns 
"embed-b-," as expected.

But str_replace("-embed-a-", "hey", "-embed-aa-", -1) hangs 
the script until the max execution time.

Removing the extraneous argument made my script work 
properly, but I would expect PHP to either ignore the extra 
argument, or return an error, rather than hanging up 
completely.

-Arlo


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22141&edit=1

Reply via email to