Skip to content

Commit c70219e

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: jit: fixed JIT "Attempt to assign property of non-object" warning emitted at the same time as Error is being thrown
2 parents 52463ae + 126a255 commit c70219e

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
@@ -14,6 +14,8 @@ PHP NEWS
1414
- Opcache:
1515
. Fixed JIT bug (Function JIT emits "Uninitialized string offset" warning
1616
at the same time as invalid offset Error). (Girgias)
17+
. Fixed JIT bug (JIT emits "Attempt to assign property of non-object"
18+
warning at the same time as Error is being thrown). (Girgias)
1719

1820
- Standard
1921
. Fixed GH-12745 (http_build_query() default null argument for $arg_separator

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,9 @@ static void ZEND_FASTCALL zend_jit_assign_dim_op_helper(zval *container, zval *d
15871587
}
15881588
zval_ptr_dtor(&res);
15891589
} else {
1590-
zend_error(E_WARNING, "Attempt to assign property of non-object");
1590+
/* Exception is thrown in this case */
1591+
GC_DELREF(obj);
1592+
return;
15911593
}
15921594
if (UNEXPECTED(GC_DELREF(obj) == 0)) {
15931595
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)