From: zend at ryank dot net
Operating system: Windows XP SP2
PHP version: 5.2.1
PHP Bug Type: Strings related
Bug description: str_ireplace crashes when working on array argument when no
match found
Description:
------------
Using str_ireplace on array elements passed to a function causes PHP crash
or apache(2.2.4) crash if the needle is not found.
In the repo code, if you use the line:
$record = array('DocumentDate' => '2007-03-02');
It will function correctly.
Workaround: use str_replace
Reproduce code:
---------------
function test($rec)
{
$preped = array();
$preped['DocumentDate'] = str_ireplace('-','',$rec['DocumentDate']);
print ' prep okay? ';
return $preped;
}
$record = array('DocumentDate' => '20070302');
print ' alive ';
$record = test($record);
print_r($record);
print ' alive ';
Expected result:
----------------
alive prep okay? Array ( [DocumentDate] => 20070302 ) alive
Actual result:
--------------
php crash or apache crash referencing php5ts.dll
--
Edit bug report at http://bugs.php.net/?id=40710&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40710&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40710&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40710&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40710&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40710&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40710&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40710&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40710&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40710&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40710&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40710&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40710&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40710&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40710&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40710&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40710&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40710&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40710&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40710&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40710&r=mysqlcfg