php-src/Zend/tests/bug60536_001.phpt
Xinchen Hui 707f658c33 Fixed bug #60536 (Traits Segfault)
# this is a tough one, I think I should explain
# Zend use zend_object->properties_table both as zval ** and zval ***
# if a zend_object->properties is not initialized, the properties_table is zval **
# while in rebuild_object_properties, zend will store the zval ** to zend_object->properties
# then stash the zval ***(ie, zobj->properties_table[0] is zval ** now) to  zobj->properties_table[0] 
# so when a zend_object inherit form multi parent and these parent have a same property_info->offset 
# properties, will result in a repeat zval **->zval ** transform, which will lead to a segmentfault
# *may be* this fix is not the best fix, we should not use this tricky way, and rewrite this mechanism.
2011-12-16 19:02:52 +00:00

27 lines
554 B
PHP

--TEST--
Bug #60536 (Traits Segfault)
--FILE--
<?php
trait T { private $x = 0; }
class X {
use T;
}
class Y extends X {
use T;
function x() {
return ++$this->x;
}
}
class Z extends Y {
function z() {
return ++$this->x;
}
}
$a = new Z();
$a->x();
echo "DONE";
?>
--EXPECTF--
Strict Standards: X and T define the same property ($x) in the composition of Y. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in %sbug60536_001.php on line %d
DONE