php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40365 bug when using str_ireplace and unserialize
Submitted: 2007-02-05 16:02 UTC Modified: 2007-02-14 12:17 UTC
From: rolf at insiders dot nl Assigned:
Status: No Feedback Package: Strings related
PHP Version: 5.2.1RC4 OS: Linux chewbacca 2.6.16-1-686-s
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-02-05 16:02 UTC] rolf at insiders dot nl
Description:
------------
PHP version :PHP Version 5.2.1RC5-dev
Build Date : Jan 29 2007 17:13:28 

When I execute this code, I get a blank page.
The log says : zend_mm_heap corrupted.

The error only occurs when I call unserialize() after calling str_ireplace with the '?' character and a string of exactly 692 characters(I did not test all possible lengths).

Any other combination compiles(for so far I tried).

Reproduce code:
---------------
<?
$var1 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
$var2 = str_ireplace("?","xx",$var1);

$ser = 'a:1:{i:0;s:1:"2";}';
$arr =  unserialize($ser);

echo "done";
?>

Expected result:
----------------
done


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-05 16:06 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Cannot reproduce.
 [2007-02-13 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-02-14 12:11 UTC] franz at prisjakt dot nu
I found this. Works on PHP 5.1.6 but segfaults with 5.2.1. Perhaps related?

http://www.1x1.jp/blog/2007/02/php521_str_ireplace.html

$Data = "Change tracking and management software designed to watch for abnormal system behavior.\nSuggest features, report bugs, or ask questions here."; $Data = str_ireplace("\r\n", "<br>", $Data); $Data = str_ireplace("\n", "<br>", $Data);
$Data = str_ireplace("\r\n", "<br>", $Data);
$Data = str_ireplace("\n", "<br>", $Data);
$Data = str_ireplace("\r\n", "<br>", $Data);
$Data = str_ireplace("\n", "<br>", $Data);
$Data = str_ireplace("\r\n", "<br>", $Data);
$Data = str_ireplace("\n", "<br>", $Data);
$Data = str_ireplace("\r\n", "<br>", $Data);
$Data = str_ireplace("\n", "<br>", $Data);
$Data = str_ireplace("\r\n", "<br>", $Data);
$Data = str_ireplace("\n", "<br>", $Data);
$Data = str_ireplace("\r\n", "<br>", $Data);
$Data = str_ireplace("\n", "<br>", $Data);
 [2007-02-14 12:17 UTC] tony2001@php.net
>Perhaps related?
It's fixed in CVS.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Nov 27 15:05:53 2022 UTC