From:             [EMAIL PROTECTED]
Operating system: Mac OS 10.2
PHP version:      4.2.3
PHP Bug Type:     Scripting Engine problem
Bug description:  str_replace hangs with extra argument

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 bug report at http://bugs.php.net/?id=22141&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22141&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22141&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22141&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22141&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22141&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22141&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22141&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22141&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22141&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22141&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22141&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22141&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22141&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22141&r=gnused

Reply via email to