mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
Fixed support for constant arrays in context of "const" statement (Zend/tests/constant_expressions_arrays.phpt failed when opcache.protect_memort was set)
This commit is contained in:
parent
a6ecb873b9
commit
c49a06168e
@ -5387,6 +5387,16 @@ ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST)
|
||||
c.value = *tmp_ptr;
|
||||
} else {
|
||||
INIT_PZVAL_COPY(&c.value, val);
|
||||
if (Z_TYPE(c.value) == IS_ARRAY) {
|
||||
HashTable *ht;
|
||||
|
||||
ALLOC_HASHTABLE(ht);
|
||||
zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL(c.value)), NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(ht, Z_ARRVAL(c.value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *));
|
||||
Z_ARRVAL(c.value) = ht;
|
||||
} else {
|
||||
zval_copy_ctor(&c.value);
|
||||
}
|
||||
zval_copy_ctor(&c.value);
|
||||
}
|
||||
c.flags = CONST_CS; /* non persistent, case sensetive */
|
||||
|
@ -4323,6 +4323,16 @@ static int ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCOD
|
||||
c.value = *tmp_ptr;
|
||||
} else {
|
||||
INIT_PZVAL_COPY(&c.value, val);
|
||||
if (Z_TYPE(c.value) == IS_ARRAY) {
|
||||
HashTable *ht;
|
||||
|
||||
ALLOC_HASHTABLE(ht);
|
||||
zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL(c.value)), NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_hash_copy(ht, Z_ARRVAL(c.value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *));
|
||||
Z_ARRVAL(c.value) = ht;
|
||||
} else {
|
||||
zval_copy_ctor(&c.value);
|
||||
}
|
||||
zval_copy_ctor(&c.value);
|
||||
}
|
||||
c.flags = CONST_CS; /* non persistent, case sensetive */
|
||||
|
Loading…
Reference in New Issue
Block a user