diff --git a/NEWS b/NEWS index 0ec9db360d1..b974da30fc6 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ PHP NEWS - Opcache: . Fixed JIT bug (Function JIT emits "Uninitialized string offset" warning at the same time as invalid offset Error). (Girgias) + . Fixed JIT bug (JIT emits "Attempt to assign property of non-object" + warning at the same time as Error is being thrown). (Girgias) - Standard . Fixed GH-12745 (http_build_query() default null argument for $arg_separator diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 5f435e328e0..f39d05c852f 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1587,7 +1587,9 @@ static void ZEND_FASTCALL zend_jit_assign_dim_op_helper(zval *container, zval *d } zval_ptr_dtor(&res); } else { - zend_error(E_WARNING, "Attempt to assign property of non-object"); + /* Exception is thrown in this case */ + GC_DELREF(obj); + return; } if (UNEXPECTED(GC_DELREF(obj) == 0)) { zend_objects_store_del(obj); diff --git a/ext/opcache/tests/jit/gh12723-B.phpt b/ext/opcache/tests/jit/gh12723-B.phpt new file mode 100644 index 00000000000..9f5ae7a19ff --- /dev/null +++ b/ext/opcache/tests/jit/gh12723-B.phpt @@ -0,0 +1,19 @@ +--TEST-- +GH-12723: JIT emits "Attempt to assign property of non-object" warning at the same time as Error is being thrown +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +Cannot use object of type stdClass as array