From: Nikita Popov Date: Tue, 22 Apr 2014 19:33:49 +0000 (+0200) Subject: Initialize hash as unpacked if it contains string keys X-Git-Tag: POST_PHPNG_MERGE~412^2~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c70603f4aab770cc629dedacfd5a6a3c0d1f46e;p=php Initialize hash as unpacked if it contains string keys --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c184de5cc9..4844128be6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5853,16 +5853,17 @@ void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ opline->opcode = ZEND_INIT_ARRAY; opline->result.var = get_temporary_variable(CG(active_op_array)); opline->result_type = IS_TMP_VAR; - opline->extended_value = is_ref; /* extval = size << 1 | is_ref */ + opline->extended_value = is_ref; /* extval = size << 2 | not_packed << 1 | is_ref */ if (expr) { - opline->extended_value += 1 << 1; + opline->extended_value += 1 << 2; /* increment size */ SET_NODE(opline->op1, expr); if (offset) { SET_NODE(opline->op2, offset); if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) { ulong index; int numeric = 0; + opline->extended_value |= 1 << 1; /* string key -> not packed */ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRLEN(CONSTANT(opline->op2.constant))+1, index, numeric = 1); if (numeric) { @@ -5884,7 +5885,7 @@ void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_b { zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); zend_op *init_opline = &CG(active_op_array)->opcodes[result->u.op.opline_num]; - init_opline->extended_value += 1 << 1; /* extval = size << 1 | is_first_ref */ + init_opline->extended_value += 1 << 2; /* increment size */ opline->opcode = ZEND_ADD_ARRAY_ELEMENT; COPY_NODE(opline->result, init_opline->result); @@ -5894,6 +5895,7 @@ void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_b if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) { ulong index; int numeric = 0; + init_opline->extended_value |= 1 << 1; /* string key -> not packed */ ZEND_HANDLE_NUMERIC_EX(Z_STRVAL(CONSTANT(opline->op2.constant)), Z_STRLEN(CONSTANT(opline->op2.constant))+1, index, numeric = 1); if (numeric) { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 2341a95ad6..bfb46b2408 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3725,7 +3725,19 @@ ZEND_VM_HANDLER(71, ZEND_INIT_ARRAY, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|UNUS { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (OP1_TYPE != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (OP1_TYPE == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if !defined(ZEND_VM_SPEC) || OP1_TYPE != IS_UNUSED diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 65bd63832a..f947c8213c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4000,7 +4000,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_H { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CONST != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -4832,7 +4844,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CONST != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -5623,7 +5647,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CONST != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -6256,7 +6292,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_ { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CONST != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -7122,7 +7170,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAND { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CONST != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CONST == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CONST != IS_UNUSED @@ -8894,7 +8954,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_TMP_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -9690,7 +9762,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_TMP_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -10481,7 +10565,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_TMP_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -11000,7 +11096,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HA { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_TMP_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -11793,7 +11901,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_TMP_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_TMP_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_TMP_VAR != IS_UNUSED @@ -15115,7 +15235,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -17186,7 +17318,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -19318,7 +19462,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -20703,7 +20859,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HA { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -22591,7 +22759,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_VAR != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_VAR == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_VAR != IS_UNUSED @@ -23995,7 +24175,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_ { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_UNUSED != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -25234,7 +25426,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HA { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_UNUSED != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -26475,7 +26679,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HA { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_UNUSED != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -27226,7 +27442,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_UNUSED != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -28203,7 +28431,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_UNUSED != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_UNUSED == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_UNUSED != IS_UNUSED @@ -31394,7 +31634,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAND { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CV != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED @@ -33348,7 +33600,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CV != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED @@ -35362,7 +35626,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CV != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED @@ -36631,7 +36907,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAN { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CV != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED @@ -38383,7 +38671,19 @@ static int ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER { USE_OPLINE - array_init_size(EX_VAR(opline->result.var), opline->extended_value >> 1); + ZVAL_NEW_ARR(EX_VAR(opline->result.var)); + zend_hash_init( + Z_ARRVAL_P(EX_VAR(opline->result.var)), + opline->extended_value >> 2, NULL, ZVAL_PTR_DTOR, 0 + ); + + if (IS_CV != IS_UNUSED) { + /* Explicitly initialize array as not-packed if flag is set */ + if (opline->extended_value & (1 << 1)) { + zend_hash_real_init(Z_ARRVAL_P(EX_VAR(opline->result.var)), 0); + } + } + if (IS_CV == IS_UNUSED) { ZEND_VM_NEXT_OPCODE(); #if 0 || IS_CV != IS_UNUSED