mirror of
https://github.com/php/php-src.git
synced 2026-04-29 19:23:22 +02:00
Fix #79475: [JIT] func_get_args() assertion violation
`func_get_args()` may return `zend_empty_array`, which has refcount 2 to enforce separation. We have to cater to that during type inference so that the optimization in the JIT macro `SEPARATE_ARRAY` doesn't prevent the separation.
This commit is contained in:
@@ -93,7 +93,7 @@ static const func_info_t func_infos[] = {
|
||||
/* zend */
|
||||
F1("zend_version", MAY_BE_STRING),
|
||||
FN("func_get_arg", UNKNOWN_INFO),
|
||||
F1("func_get_args", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
|
||||
FN("func_get_args", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY),
|
||||
F1("get_class_vars", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
|
||||
FN("get_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
|
||||
FN("get_mangled_object_vars", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
|
||||
|
||||
@@ -3465,7 +3465,7 @@ static zend_always_inline int _zend_update_type_info(
|
||||
UPDATE_SSA_TYPE(MAY_BE_LONG, ssa_op->result_def);
|
||||
break;
|
||||
case ZEND_FUNC_GET_ARGS:
|
||||
UPDATE_SSA_TYPE(MAY_BE_RC1| MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY, ssa_op->result_def);
|
||||
UPDATE_SSA_TYPE(MAY_BE_RC1|MAY_BE_RCN| MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ANY, ssa_op->result_def);
|
||||
break;
|
||||
case ZEND_GET_CLASS:
|
||||
case ZEND_GET_CALLED_CLASS:
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #79475 ([JIT] func_get_args() assertion violation)
|
||||
--SKIPIF--
|
||||
<?php require_once('skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
function foo() {
|
||||
$args = func_get_args();
|
||||
$args[] = "bar";
|
||||
}
|
||||
foo();
|
||||
echo "done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
Reference in New Issue
Block a user