From: Pedro Magalhães Date: Fri, 1 Dec 2017 16:08:11 +0000 (+0000) Subject: Fix #75607 - Check if existing static trait property is a ref before comparing X-Git-Tag: php-7.2.2RC1~76 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83964e0468e7f4ae39cd1435f3b53f62e174ac21;p=php Fix #75607 - Check if existing static trait property is a ref before comparing --- diff --git a/Zend/tests/traits/bug75607.phpt b/Zend/tests/traits/bug75607.phpt new file mode 100644 index 0000000000..a3a10425f4 --- /dev/null +++ b/Zend/tests/traits/bug75607.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #75607 (Comparision of initial static properties failing) +--FILE-- + +--EXPECT-- +DONE diff --git a/Zend/tests/traits/bug75607a.phpt b/Zend/tests/traits/bug75607a.phpt new file mode 100644 index 0000000000..9f5f03521e --- /dev/null +++ b/Zend/tests/traits/bug75607a.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #75607 (Comparision of initial static properties failing) +--FILE-- + +--EXPECT-- +int(1) diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 7689a7c963..383df1a0f9 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1568,13 +1568,17 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */ if ((coliding_prop->flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC)) == (flags & (ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC))) { /* flags are identical, now the value needs to be checked */ + zval *op1, *op2; if (flags & ZEND_ACC_STATIC) { - not_compatible = fast_is_not_identical_function(&ce->default_static_members_table[coliding_prop->offset], - &ce->traits[i]->default_static_members_table[property_info->offset]); + op1 = &ce->default_static_members_table[coliding_prop->offset]; + op2 = &ce->traits[i]->default_static_members_table[property_info->offset]; + ZVAL_DEREF(op1); + ZVAL_DEREF(op2); } else { - not_compatible = fast_is_not_identical_function(&ce->default_properties_table[OBJ_PROP_TO_NUM(coliding_prop->offset)], - &ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]); + op1 = &ce->default_properties_table[OBJ_PROP_TO_NUM(coliding_prop->offset)]; + op2 = &ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]; } + not_compatible = fast_is_not_identical_function(op1, op2); } else { /* the flags are not identical, thus, we assume properties are not compatible */ not_compatible = 1;