diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index 1ac62c859286..f1fe2dc39aad 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -5268,7 +5268,7 @@ ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op case ZEND_ROPE_END: return t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT); case ZEND_INIT_ARRAY: - return (opline->op2_type != IS_UNUSED) && (t2 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); + return (opline->op2_type != IS_UNUSED) && (t2 & (MAY_BE_NULL|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); case ZEND_ADD_ARRAY_ELEMENT: return (opline->op2_type == IS_UNUSED) || (t2 & (MAY_BE_NULL|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)); case ZEND_STRLEN: diff --git a/ext/opcache/tests/jit/gh25269.phpt b/ext/opcache/tests/jit/gh25269.phpt new file mode 100644 index 000000000000..6e9cc017b2ad --- /dev/null +++ b/ext/opcache/tests/jit/gh25269.phpt @@ -0,0 +1,27 @@ +--TEST-- +GH-25269 (JIT: misaligned zval passed to ZEND_ADD_ARRAY_ELEMENT handler) +--CREDITS-- +YuanChengJiang +--EXTENSIONS-- +opcache +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit_buffer_size=64M +opcache.jit=function +--FILE-- + 1, "a" => 2, "b" => 3]; +} +try { + test(); +} catch (ErrorException $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Using null as an array offset is deprecated, use an empty string instead