diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 867d2a5ddb5..932920d044b 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -3348,7 +3348,12 @@ static zend_always_inline int _zend_update_type_info( ZEND_ASSERT(j < 0 && "There should only be one use"); } } - if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY)) || opline->opcode == ZEND_FETCH_DIM_FUNC_ARG) { + if (((tmp & MAY_BE_ARRAY) && (tmp & MAY_BE_ARRAY_KEY_ANY)) + || opline->opcode == ZEND_FETCH_DIM_FUNC_ARG + || opline->opcode == ZEND_FETCH_DIM_R + || opline->opcode == ZEND_FETCH_DIM_IS + || opline->opcode == ZEND_FETCH_DIM_UNSET + || opline->opcode == ZEND_FETCH_LIST_R) { UPDATE_SSA_TYPE(tmp, ssa_op->op1_def); } else { /* invalid key type */ diff --git a/ext/opcache/tests/opt/inference_012.phpt b/ext/opcache/tests/opt/inference_012.phpt new file mode 100644 index 00000000000..2c123b32fac --- /dev/null +++ b/ext/opcache/tests/opt/inference_012.phpt @@ -0,0 +1,26 @@ +--TEST-- +Type inference 012: FETCH_DIM_UNSET +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--FILE-- + $closure(), 'b' => [$closure() => []]]; + $x = $arr; + unset($x['b'][$closure()]['d']); + $x = $arr; +} + +test(); +?> +DONE +--EXPECTF-- +Warning: Undefined variable $x in %sinference_012.php on line 4 + +Warning: Undefined variable $arr in %sinference_012.php on line 5 +DONE