Skip to content

Commit a827742

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix JIT for recursive call with too few args
2 parents 54bbee9 + 10bbff8 commit a827742

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9759,7 +9759,8 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
97599759
}
97609760
}
97619761

9762-
if (!trace && op_array == &func->op_array) {
9762+
if (!trace && op_array == &func->op_array
9763+
&& num_args >= op_array->required_num_args) {
97639764
/* recursive call */
97649765
if (ZEND_OBSERVER_ENABLED) {
97659766
| SAVE_IP
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Recursive call with too few args
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=32M
8+
--FILE--
9+
<?php
10+
function f($arg) {
11+
f();
12+
}
13+
try {
14+
f();
15+
} catch (ArgumentCountError $e) {
16+
echo $e->getMessage(), "\n";
17+
}
18+
?>
19+
--EXPECTF--
20+
Too few arguments to function f(), 0 passed in %s on line %d and exactly 1 expected

0 commit comments

Comments
 (0)