From: phpbugs at colin dot guthr dot ie Operating system: Mandriva Linux (Cooker x86_64) PHP version: 5.3.1RC2 PHP Bug Type: Reproducible crash Bug description: $this becomes a non-object
Description: ------------ This is a really hard bug to reproduce (e.g. build a simple test case) but I can reliably do so here with my application. I'll attempt to describe the problem in depth, although I warn in advance that it's a bit of a confusing one. During a particular request, PHP seems to corrupt itself quite badly which cases $this to become corrupted within an object. When this happens, is_object($this) still returns true, but any attempt to access a member variable (e.g. $this->mFuncs) will result in the "Notice: Trying to get property of non-object" warning. Similar warning exist when trying to call methods etc. Once this corruption happens, it will remain until the Apache process is restarted (mpm-prefork) although some requests will succeed (I presume it depends what mpm-preforked httpd handler is used?). When this happens, a much simpler test case (which I'll link to) fails also (i.e. it seems that the initial trigger of this causes it to continue, but the simpler test case itself does not seem enough to trigger it initially). The trigger case I have is a rather complex Zend Framework application that I sadly cannot share. I have confirmed this problem is present on 5.3.0 and 5.3.1RC2, so I suspect it's a 5.3.x problem over all. I cannot reproduce the problem on 5.2.11. All builds use -O0 for optimisations (as higher values have proven to cause problems, particularly on x86_64). Reproduce code: --------------- A tarball containing three PHP files: one a UniversalAutoloader structure we use in our projects (it predates spl stuff and actually gives us a different fallback mechanism anyway), and a simple test class that is meant to be autoloaded. Then the test.php file which actually exhibits the bug. As noted previously however, this test case only *exhibits* this bug if the problem is triggered already by some other code. You can see from the backtrace.txt the effect of it failing. I provide this in the hope that it allows something obvious to jump out at you, but I suspect the problem is really some form of stack frame corruption or similar (possibly due to x86_64 as I've not tested to see if it affects 5.3.1 although I will be able to do so in the coming weeks). The URL for this bundle is: http://colin.guthr.ie/php-bug.tar Expected result: ---------------- It should just echo "Foo\n". But as you can see the Notice is triggered and the is_array() check fails (as can be seen, it is impossible for the variable to be anything other than an array). Actual result: -------------- *After* triggering the problem, $this becomes a non-object (although in other tests (is_object($this) still returns true). -- Edit bug report at http://bugs.php.net/?id=50027&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50027&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50027&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50027&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50027&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50027&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50027&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50027&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50027&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50027&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50027&r=support Expected behavior: http://bugs.php.net/fix.php?id=50027&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50027&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50027&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50027&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50027&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50027&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50027&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50027&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50027&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50027&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50027&r=mysqlcfg