From 35d38e4772c4c6c0f92475471252fc08659ac84f Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Wed, 23 Nov 2011 21:24:34 +0000 Subject: [PATCH] Fixed Bug #60369 Crash with static property in trait --- Zend/tests/traits/bug60369.phpt | 17 +++++++++++++++++ Zend/zend_compile.c | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Zend/tests/traits/bug60369.phpt diff --git a/Zend/tests/traits/bug60369.phpt b/Zend/tests/traits/bug60369.phpt new file mode 100644 index 0000000000..bfc1ee303f --- /dev/null +++ b/Zend/tests/traits/bug60369.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #60369 (Crash with static property in trait) +--FILE-- + +--EXPECTF-- +Fatal error: Properties and PropertiesTrait define the same property ($same) in the composition of Properties. However, the definition differs and is considered incompatible. Class was composed in %s on line %d \ No newline at end of file diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 40d2e93a97..215edf61d2 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4272,10 +4272,11 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { /* this one is inherited, lets look it up in its own class */ zend_hash_quick_find(&coliding_prop->ce->properties_info, prop_name, prop_name_length+1, prop_hash, (void **) &coliding_prop); } - if ((coliding_prop->flags & ZEND_ACC_PPP_MASK) == (property_info->flags & ZEND_ACC_PPP_MASK)) { + if ( (coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC)) + == (property_info->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) { /* flags are identical, now the value needs to be checked */ if (property_info->flags & ZEND_ACC_STATIC) { - not_compatible = (FAILURE == compare_function(&compare_result, + not_compatible = (FAILURE == compare_function(&compare_result, ce->default_static_members_table[coliding_prop->offset], ce->traits[i]->default_static_members_table[property_info->offset] TSRMLS_CC)) || (Z_LVAL(compare_result) != 0); -- 2.50.1