JIT: Fixed incorrect named parameter handling

This commit is contained in:
Dmitry Stogov 2021-09-30 14:51:43 +03:00
parent 4b31cb3eb8
commit 512dfaba3a
2 changed files with 27 additions and 0 deletions

View file

@ -4759,6 +4759,10 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
}
goto done;
case ZEND_CHECK_UNDEF_ARGS:
if (JIT_G(current_frame)
&& JIT_G(current_frame)->call) {
TRACE_FRAME_SET_UNKNOWN_NUM_ARGS(JIT_G(current_frame)->call);
}
if (!zend_jit_check_undef_args(&dasm_state, opline)) {
goto jit_failure;
}

View file

@ -0,0 +1,23 @@
--TEST--
JIT SEND_VAR_EX may leak with named args
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
for ($i = 0; $i < 3; $i++ ) {
$x = 0;
test(a: $x);
var_dump($x);
}
function test(&$a = null, SomeType &$b = null) {
$a++;
}
?>
--EXPECT--
int(1)
int(1)
int(1)