]> granicus.if.org Git - php/commitdiff
Class constants and default property values can't be IS_REFERENCE anymore.
authorDmitry Stogov <dmitry@zend.com>
Tue, 18 Sep 2018 15:46:10 +0000 (18:46 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 18 Sep 2018 15:46:10 +0000 (18:46 +0300)
Zend/zend_API.c
Zend/zend_builtin_functions.c
ext/opcache/zend_accelerator_util_funcs.c

index 199735ec4a1b3d01b735b8bcc7d915f7306ad499..8c6113c0e15cced2c319fc46b8e1f2ea25906f6c 100644 (file)
@@ -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;
index 88c24ba8aeb377f79f41ca8cb26bcd99aff3da00..f8748b93f23f516ca78dd5b76b62c469accf02f1 100644 (file)
@@ -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;
 
index d9802133b00798ef1eb090031fb1d64642948002..2669333e4b14530ec181c600e35b64fab9ecb5b6 100644 (file)
@@ -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 */