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
This commit is contained in:
Gina Peter Banyard 2023-11-27 16:19:49 +00:00
commit c70219e4aa
No known key found for this signature in database
GPG Key ID: 3306078E3194AEBD
3 changed files with 24 additions and 1 deletions

2
NEWS
View File

@ -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

View File

@ -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);

View File

@ -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--
<?php
$container = new stdClass();
try {
$container[new stdClass()] .= 'append';
} catch (\Throwable $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot use object of type stdClass as array