com php-src: Merge branch 'PHP-7.2': Zend/zend_inheritance. c
| From: | Nikita Popov | Date: | Sat, 16 Dec 2017 16:10:09 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.2': Zend/zend_inheritance. c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100611@lists.php.net to get a copy of this message | ||
Commit: 3fde27d87da5dba9679669db6b4ce92c77a4dd27
Author: Nikita Popov <nikita.ppv@gmail.com> Sat, 16 Dec 2017 17:10:09 +0100
Parents: ef9d2cecc66cc474ef54e3b157cded202c3a60aa 83964e0468e7f4ae39cd1435f3b53f62e174ac21
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3fde27d87da5dba9679669db6b4ce92c77a4dd27
Log:
Merge branch 'PHP-7.2'
Changed paths:
MM Zend/zend_inheritance.c
Diff:
diff --cc Zend/zend_inheritance.c
index 00d0a9a,383df1a..ef83622
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance..c
@@@ -1594,32 -1565,23 +1594,44 @@@ static void zend_do_traits_property_bin
zend_hash_del(&ce->properties_info, prop_name);
flags |= ZEND_ACC_CHANGED;
} else {
+ not_compatible = 1;
+
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 */
+ /* the flags are identical, thus, the properties may be compatible */
- zval op1, op2;
+ zval *op1, *op2;
++ zval op1_tmp, op2_tmp;
+
if (flags & ZEND_ACC_STATIC) {
- ZVAL_COPY_OR_DUP(&op1,
&ce->default_static_members_table[coliding_prop->offset]);
- ZVAL_COPY_OR_DUP(&op2,
&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 {
- ZVAL_COPY_OR_DUP(&op1,
&ce->default_properties_table[OBJ_PROP_TO_NUM(coliding_prop->offset)]);
- ZVAL_COPY_OR_DUP(&op2,
&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)];
}
+
+ /* if any of the values is a constant, we try to resolve it */
- if (UNEXPECTED(Z_TYPE(op1) == IS_CONSTANT_AST)) {
- zval_update_constant_ex(&op1, ce);
++ if (UNEXPECTED(Z_TYPE_P(op1) == IS_CONSTANT_AST)) {
++ ZVAL_COPY_OR_DUP(&op1_tmp, op1);
++ zval_update_constant_ex(&op1_tmp, ce);
++ op1 = &op1_tmp;
+ }
- if (UNEXPECTED(Z_TYPE(op2) == IS_CONSTANT_AST)) {
- zval_update_constant_ex(&op2, ce);
++ if (UNEXPECTED(Z_TYPE_P(op2) == IS_CONSTANT_AST)) {
++ ZVAL_COPY_OR_DUP(&op2_tmp, op2);
++ zval_update_constant_ex(&op2_tmp, ce);
++ op2 = &op2_tmp;
+ }
+
- not_compatible = fast_is_not_identical_function(&op1, &op2);
- zval_ptr_dtor_nogc(&op1);
- zval_ptr_dtor_nogc(&op2);
+ 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;
++
++ if (op1 == &op1_tmp) {
++ zval_ptr_dtor_nogc(&op1_tmp);
++ }
++ if (op2 == &op2_tmp) {
++ zval_ptr_dtor_nogc(&op2_tmp);
++ }
}
if (not_compatible) {