Skip to content

Commit 512dfab

Browse files
committed
JIT: Fixed incorrect named parameter handling
1 parent 4b31cb3 commit 512dfab

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4759,6 +4759,10 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
47594759
}
47604760
goto done;
47614761
case ZEND_CHECK_UNDEF_ARGS:
4762+
if (JIT_G(current_frame)
4763+
&& JIT_G(current_frame)->call) {
4764+
TRACE_FRAME_SET_UNKNOWN_NUM_ARGS(JIT_G(current_frame)->call);
4765+
}
47624766
if (!zend_jit_check_undef_args(&dasm_state, opline)) {
47634767
goto jit_failure;
47644768
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
JIT SEND_VAR_EX may leak with named args
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
for ($i = 0; $i < 3; $i++ ) {
11+
$x = 0;
12+
test(a: $x);
13+
var_dump($x);
14+
}
15+
16+
function test(&$a = null, SomeType &$b = null) {
17+
$a++;
18+
}
19+
?>
20+
--EXPECT--
21+
int(1)
22+
int(1)
23+
int(1)

0 commit comments

Comments
 (0)