From: dzoukr at dzoukr dot cz
Operating system: Windows XP SP2
PHP version: 5.2.1
PHP Bug Type: Reproducible crash
Bug description: Function str_ireplace() crashes Apache server
Description:
------------
Hi guys, yesterday I found a bug, which has been making me mad for a long
time. I found out that function str_ireplace() in current version (5.2.1)
on Apache2 (WinXP SP2) crashes server. I looked in release log, where is
something about buffer overflow for str_replace(), but it seems that
function str_ireplace() has been forgotten. It happens on multi-using this
function.
Reproduce code:
---------------
<?php
$string = "not so long text, maybe less than 1000 chars";
$result = str_ireplace("A", "B", $string);
$result = str_ireplace("B", "C", $result);
$result = str_ireplace("C", "D", $result);
$result = str_ireplace("D", "E", $result);
$result = str_ireplace("E", "F", $result);
?>
Expected result:
----------------
String with replaced chars
Actual result:
--------------
Apache crashes - browser says, that connection with server has been
corrupted during page loading!
--
Edit bug report at http://bugs.php.net/?id=40943&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40943&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40943&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40943&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40943&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40943&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40943&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40943&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40943&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40943&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40943&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40943&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40943&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40943&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40943&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40943&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40943&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40943&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40943&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40943&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40943&r=mysqlcfg