diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index f0d8d873977e2..f03999aa114ec 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -3719,6 +3719,11 @@ static zend_always_inline zend_result _zend_update_type_info( if (opline->opcode != ZEND_FETCH_DIM_FUNC_ARG) { tmp &= ~MAY_BE_ARRAY_EMPTY; } + } else if ((opline->opcode == ZEND_FETCH_DIM_W + || opline->opcode == ZEND_FETCH_DIM_RW + || opline->opcode == ZEND_FETCH_LIST_W) + && (tmp & MAY_BE_ARRAY)) { + tmp &= ~MAY_BE_ARRAY_EMPTY; } if (!(tmp & MAY_BE_ARRAY) || (tmp & MAY_BE_ARRAY_KEY_ANY) diff --git a/Zend/tests/gh17144.phpt b/Zend/tests/gh17144.phpt new file mode 100644 index 0000000000000..2c394a14fac4d --- /dev/null +++ b/Zend/tests/gh17144.phpt @@ -0,0 +1,24 @@ +--TEST-- +GH-17144 (Assertion failure during type inference of ZEND_FETCH_DIM_W) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=1254 +--EXTENSIONS-- +opcache +--FILE-- + 1, + ]; + } +} +echo "Done\n"; +?> +--EXPECT-- +Done