From: laruence
Operating system:
PHP version: 5.4.6
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Double free when use traits
Description:
------------
This bug is related to #61998, but was spotting when I fixing the bug
#62358, PS:
it really tough to refine this reproduce script :)
Test script:
---------------
<?php
function __autoload($name) {
if ($name == "B") {
eval ("abstract class B extends A { }");
} else if ($name == "A") {
eval ("abstract class A { use T { T::__construct as __asconstruct;
}}");
} else if ($name == "T") {
eval ("trait T { public function __construct() { } }");
}
return TRUE;
}
class C extends B {
public function __construct() {
}
}
Expected result:
----------------
no error
Actual result:
--------------
[Thu Aug 23 23:34:22 2012] Script:
'/home/huixinchen/bug_double_free.phpt'
---------------------------------------
/home/huixinchen/opensource/trunk/Zend/zend_opcode.c(392) : Block
0x2b2c499c8820
status:
Beginning: Cached
Freed (invalid)
Start: OK
End: OK
---------------------------------------
[Thu Aug 23 23:34:22 2012] Script:
'/home/huixinchen/bug_double_free.phpt'
Zend/zend_language_scanner.l(1903) : Freeing 0x2B2C499C4AA0 (12 bytes),
script=/home/huixinchen/bug_double_free.phpt
=== Total 1 memory leaks detected ===
--
Edit bug report at https://bugs.php.net/bug.php?id=62907&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=62907&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=62907&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=62907&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=62907&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=62907&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=62907&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=62907&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=62907&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=62907&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=62907&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=62907&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=62907&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=62907&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=62907&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=62907&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62907&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=62907&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=62907&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=62907&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=62907&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=62907&r=mysqlcfg