From 126a255d66d3c2b2161bce8c20eb2d09bbf0b690 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 27 Nov 2023 16:19:35 +0000 Subject: [PATCH] jit: fixed JIT "Attempt to assign property of non-object" warning emitted at the same time as Error is being thrown --- NEWS | 2 ++ ext/opcache/jit/zend_jit_helpers.c | 4 +++- ext/opcache/tests/jit/gh12723-B.phpt | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 ext/opcache/tests/jit/gh12723-B.phpt diff --git a/NEWS b/NEWS index 2bc78b317ab..0cc4d64783b 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,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) - OpenSSL: . Fixed bug #50713 (openssl_pkcs7_verify() may ignore untrusted CAs). diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index a838a735823..69c7ca3a537 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -1591,7 +1591,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