diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 97b5aa3ede6..c65104cee78 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -3312,10 +3312,18 @@ static zend_always_inline int _zend_update_type_info( zend_uchar opcode; if (!ssa_opcodes) { - ZEND_ASSERT(j == (opline - op_array->opcodes) + 1 && "Use must be in next opline"); + if (j != (opline - op_array->opcodes) + 1) { + /* Use must be in next opline */ + tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; + break; + } opcode = op_array->opcodes[j].opcode; } else { - ZEND_ASSERT(ssa_opcodes[j] == opline + 1 && "Use must be in next opline"); + if (ssa_opcodes[j] != opline + 1) { + /* Use must be in next opline */ + tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; + break; + } opcode = ssa_opcodes[j]->opcode; } switch (opcode) { @@ -3374,7 +3382,10 @@ static zend_always_inline int _zend_update_type_info( EMPTY_SWITCH_DEFAULT_CASE() } j = zend_ssa_next_use(ssa->ops, ssa_op->result_def, j); - ZEND_ASSERT(j < 0 && "There should only be one use"); + if (j >= 0) { + tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; + break; + } } } if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY)) diff --git a/ext/opcache/tests/opt/inference_022.phpt b/ext/opcache/tests/opt/inference_022.phpt new file mode 100644 index 00000000000..b745499f602 --- /dev/null +++ b/ext/opcache/tests/opt/inference_022.phpt @@ -0,0 +1,17 @@ +--TEST-- +Type inference 022: FETCH_DIM_W +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--FILE-- + +DONE +--EXPECT-- +DONE