Skip to content

Commit 126a255

Browse files
committed
jit: fixed JIT "Attempt to assign property of non-object" warning emitted at the same time as Error is being thrown
1 parent ed8b901 commit 126a255

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ PHP NEWS
3232
- Opcache:
3333
. Fixed JIT bug (Function JIT emits "Uninitialized string offset" warning
3434
at the same time as invalid offset Error). (Girgias)
35+
. Fixed JIT bug (JIT emits "Attempt to assign property of non-object"
36+
warning at the same time as Error is being thrown). (Girgias)
3537

3638
- OpenSSL:
3739
. Fixed bug #50713 (openssl_pkcs7_verify() may ignore untrusted CAs).

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,9 @@ static void ZEND_FASTCALL zend_jit_assign_dim_op_helper(zval *container, zval *d
15911591
}
15921592
zval_ptr_dtor(&res);
15931593
} else {
1594-
zend_error(E_WARNING, "Attempt to assign property of non-object");
1594+
/* Exception is thrown in this case */
1595+
GC_DELREF(obj);
1596+
return;
15951597
}
15961598
if (UNEXPECTED(GC_DELREF(obj) == 0)) {
15971599
zend_objects_store_del(obj);

ext/opcache/tests/jit/gh12723-B.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
GH-12723: JIT emits "Attempt to assign property of non-object" warning at the same time as Error is being thrown
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
--FILE--
7+
<?php
8+
9+
$container = new stdClass();
10+
11+
try {
12+
$container[new stdClass()] .= 'append';
13+
} catch (\Throwable $e) {
14+
echo $e->getMessage(), "\n";
15+
}
16+
17+
?>
18+
--EXPECT--
19+
Cannot use object of type stdClass as array

0 commit comments

Comments
 (0)