From:             johan at braattha dot se
Operating system: windows2000
PHP version:      4.3.4
PHP Bug Type:     Reproducible crash
Bug description:  using str_replace() together with while chaches PHP

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

Reply via email to