diff --git a/Zend/tests/func_arg_fetch_optimization.phpt b/Zend/tests/func_arg_fetch_optimization.phpt new file mode 100644 index 00000000000..ba01d8f7dee --- /dev/null +++ b/Zend/tests/func_arg_fetch_optimization.phpt @@ -0,0 +1,15 @@ +--TEST-- +FETCH_DIM_FUNC_ARG that cannot be optimized to FETCH_DIM_R because it appends +--FILE-- +getMessage(), "\n"; +} +?> +--EXPECT-- +Cannot use [] for reading diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index b981a1fc1de..5fa33e0c96c 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -3389,6 +3389,7 @@ static zend_always_inline int _zend_update_type_info( * is already an object. */ break; case ZEND_SEND_VAR: + case ZEND_FETCH_DIM_R: /* This can occur if a DIM_FETCH_FUNC_ARG with UNUSED op2 is left * behind, because it can't be converted to DIM_FETCH_R. */ break;