diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 5f7a06b2a19..5169d9f720a 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -1976,6 +1976,9 @@ static uint32_t assign_dim_array_result_type( tmp |= MAY_BE_ARRAY_KEY_STRING; if (dim_op_type != IS_CONST) { // FIXME: numeric string + if (arr_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) { + tmp |= MAY_BE_ARRAY_PACKED; + } tmp |= MAY_BE_HASH_ONLY(arr_type) ? MAY_BE_ARRAY_NUMERIC_HASH : MAY_BE_ARRAY_KEY_LONG; } } diff --git a/ext/opcache/tests/opt/inference_015.phpt b/ext/opcache/tests/opt/inference_015.phpt new file mode 100644 index 00000000000..e64c02225b3 --- /dev/null +++ b/ext/opcache/tests/opt/inference_015.phpt @@ -0,0 +1,19 @@ +--TEST-- +Type inference 015: ASSIGN_DIM_OP +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--FILE-- + +DONE +--EXPECT-- +DONE