summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_execute.h
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/zend_vm_execute.h')
-rw-r--r--Zend/zend_vm_execute.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index ce1efa8805..d2fc1bf089 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -4036,9 +4036,6 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
}
}
constant_fetch_end:
- if (Z_TYPE(EX_T(opline->result.var).tmp_var) == IS_ARRAY) {
- zend_error_noreturn(E_ERROR, "Arrays are not allowed in constants at run-time");
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -4323,7 +4320,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);
- zval_copy_ctor(&c.value);
+ 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);
+ }
}
c.flags = CONST_CS; /* non persistent, case sensetive */
c.name = str_strndup(Z_STRVAL_P(name), Z_STRSIZE_P(name));
@@ -15992,9 +15998,6 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
}
}
constant_fetch_end:
- if (Z_TYPE(EX_T(opline->result.var).tmp_var) == IS_ARRAY) {
- zend_error_noreturn(E_ERROR, "Arrays are not allowed in constants at run-time");
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
@@ -25604,9 +25607,6 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
}
}
constant_fetch_end:
- if (Z_TYPE(EX_T(opline->result.var).tmp_var) == IS_ARRAY) {
- zend_error_noreturn(E_ERROR, "Arrays are not allowed in constants at run-time");
- }
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}