Bug #62339 [Opn]: zend_mm_heap corrupted when trait is autoloaded after a class that uses it.
Edit report at https://bugs.php.net/bug.php?id=62339&edit=1
ID: 62339
Updated by: laruence@php.net
Reported by: manchokapitancho at gmail dot com
Summary: zend_mm_heap corrupted when trait is autoloaded
after a class that uses it.
Status: Open
Type: Bug
Package: Reproducible crash
Operating System: win 7
PHP Version: 5.4.4
-Assigned To:
+Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
Dmitry, could you please look at this?
thanks
Previous Comments:
------------------------------------------------------------------------
[2012-06-16 22:06:01] manchokapitancho at gmail dot com
Description:
------------
Bugs #61998 and #62234 seem to be really close to this:
PHP crashes after the script finishes. It echoes "zend_mm_heap corrupted".
Necessary components (ALL required):
1. A class that uses a trait.
2. The trait should contain a method that also exists in the class.
3. This trait method is loaded as an alias in the class.
4. The trait should be in a separate file that is loaded after the file that
contains the class (__autoload)
5. There should be some other code loaded and parsed. The amount of code has some
randomness but a class with 5000 methods usually works :)
Note: there is a serious randomness in the crash. Sometimes I get it constantly,
sometimes it crashes when called from apache only and sometimes it may crash once
and then start working fine.
Test script:
---------------
main.php
---------
function __autoload ($class) {
include 'trait.php';
}
include 'demo.php';
$demo = new demo;
echo $demo->someFunc0();
echo $demo->broken();
trait.php
----------
trait a {
function broken() { return 'broken'; }
}
demo.php
---------
class demo {
use a { broken as private broken_old; }
function broken() { return "OK:" . $this->broken_old(); }
function someFunc0(){return 0;}
... //a small number of method may not trigger that crash.
function someFunc5000(){return 5000;}
}
Expected result:
----------------
OK:broken
Actual result:
--------------
OK:broken
zend_mm_heap corrupted
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62339&edit=1
Thread (10 messages)