From b634ded197f0b79c3c6aa804181b37aeaa15fc58 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 18 Sep 2018 18:46:10 +0300 Subject: [PATCH] Class constants and default property values can't be IS_REFERENCE anymore. --- Zend/zend_API.c | 1 - Zend/zend_builtin_functions.c | 1 - ext/opcache/zend_accelerator_util_funcs.c | 22 ---------------------- 3 files changed, 24 deletions(-) diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 199735ec4a..8c6113c0e1 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1172,7 +1172,6 @@ ZEND_API int zend_update_class_constants(zend_class_entry *class_type) /* {{{ */ } else { val = (zval*)((char*)class_type->default_properties_table + prop_info->offset - OBJ_PROP_TO_OFFSET(0)); } - ZVAL_DEREF(val); if (Z_TYPE_P(val) == IS_CONSTANT_AST) { if (UNEXPECTED(zval_update_constant_ex(val, ce) != SUCCESS)) { return FAILURE; diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 88c24ba8ae..f8748b93f2 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1115,7 +1115,6 @@ static void add_class_vars(zend_class_entry *scope, zend_class_entry *ce, int st } /* copy: enforce read only access */ - ZVAL_DEREF(prop); ZVAL_COPY_OR_DUP(&prop_copy, prop); prop = &prop_copy; diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index d9802133b0..2669333e4b 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -95,25 +95,6 @@ void zend_accel_move_user_functions(HashTable *src, zend_script *script) src->pDestructor = orig_dtor; } -static inline void zend_clone_zval(zval *src) -{ - void *ptr; - - if (Z_TYPE_P(src) == IS_REFERENCE) { - ptr = accel_xlat_get(Z_REF_P(src)); - if (ptr != NULL) { - Z_REF_P(src) = ptr; - return; - } else { - zend_reference *old = Z_REF_P(src); - ZVAL_NEW_REF(src, &old->val); - Z_REF_P(src)->gc = old->gc; - accel_xlat_set(old, Z_REF_P(src)); - src = Z_REFVAL_P(src); - } - } -} - static void zend_hash_clone_constants(HashTable *ht, HashTable *source) { Bucket *p, *q, *end; @@ -157,7 +138,6 @@ static void zend_hash_clone_constants(HashTable *ht, HashTable *source) c = ARENA_REALLOC(Z_PTR(p->val)); ZVAL_PTR(&q->val, c); - zend_clone_zval(&c->value); if ((void*)c->ce >= ZCG(current_persistent_script)->arena_mem && (void*)c->ce < (void*)((char*)ZCG(current_persistent_script)->arena_mem + ZCG(current_persistent_script)->arena_size)) { c->ce = ARENA_REALLOC(c->ce); @@ -303,7 +283,6 @@ static void zend_class_copy_ctor(zend_class_entry **pce) dst = ce->default_properties_table; for (; src != end; src++, dst++) { ZVAL_COPY_VALUE(dst, src); - zend_clone_zval(dst); } } @@ -322,7 +301,6 @@ static void zend_class_copy_ctor(zend_class_entry **pce) for (; i >= end; i--) { zval *p = &ce->default_static_members_table[i]; ZVAL_COPY_VALUE(p, &old_ce->default_static_members_table[i]); - zend_clone_zval(p); } /* Create indirections to static properties from parent classes */ -- 2.40.0