#31742 [Bgs]: print_r tries to allocate 1.5gb RAM and fails, corrupt array/hash?

From: Date: Fri, 11 Feb 2005 07:18:57 +0000
Subject: #31742 [Bgs]: print_r tries to allocate 1.5gb RAM and fails, corrupt array/hash?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73866@lists.php.net to get a copy of this message
ID: 31742 User updated by: frode at coretrek dot no Reported By: frode at coretrek dot no Status: Bogus Bug Type: Scripting Engine problem Operating System: FreeBSD 4.10 PHP Version: 4CVS-2005-01-28 (PHP_4_3 only!) New Comment: Well, I've given you backtraces which perhaps can point to parts of the code which may or may not contain a reference-counting bug, and I think it's a shame a data-corrupting bug like this will go unfixed. Again, if you have any suggestions, I'm willing to try them out in GDB or whatever, and we can work together to nail this crasher down :) Previous Comments: ------------------------------------------------------------------------ [2005-02-11 05:07:40] sniper@php.net We can't fix what we can't test.. ------------------------------------------------------------------------ [2005-02-10 15:12:07] frode at coretrek dot no I'm unable to produce a simple test case, because the bug only appears with the right combination of database calls and when all the classes in our application are include()'d (I'm guessing about 100+ classes are in use, spread over ~500 files). Unfortunately, I'm not at liberty to provide the source code. I understand this complicates debugging a lot, but I can run GDB traces and compile debug versions of PHP with any patches/changes you might suggest, or anything else you might want, and post back the results. Hope to hear from you soon! ------------------------------------------------------------------------ [2005-02-10 15:01:52] sniper@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try to avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2005-02-06 07:03:15] sniper@php.net Please don't put such huge backtraces in the bug report, instead, put them online somewhere and paste the URL here. I deleted the one huge comment of yours, it can be viewed still in the mailing list archives, so don't readd it here.. ------------------------------------------------------------------------ [2005-02-01 09:26:00] frode at coretrek dot no OK, I grabbed the http://snaps.php.net/php5-latest.tar.gz file and compiled, changed all 'php4' references to 'php5' in httpd.conf and started up apache in gdb again. With this version of PHP, our application won't run at all. I get an error "Cannot reassign $this in XXX on line YYY ". The source code referred from that error message looks like this (in the middle of a class) function printHtml() { $asw =& $this; <- line with error .. } This occured in three different files. By changing all places into "$asw = $this" (no '&'), I got things running fine. (Isn't assignment of objects by-ref by default in php5 anyway?) My code seems to work fine in both the PHP5 snapshot of today, and in PHP-5.0.3. (I didn't have to remove the '&' to get things to run in PHP-5.0.3). I guess this means this is a php4 only bug (either that, or php5 is different enough so that the bug is not visible in this particular case). What's the next step? :) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31742 -- Edit this bug report at http://bugs.php.net/?id=31742&edit=1

« previous php.bugs (#73866) next »