1
0
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:
Christoph M. Becker
2020-04-17 09:48:15 +02:00
parent 7a260a4a1c
commit a1eaaa692e
3 changed files with 17 additions and 2 deletions
+1 -1
View File
@@ -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),
+1 -1
View File
@@ -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:
+15
View File
@@ -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