Fixed type inference for COPY_TMP

This commit is contained in:
Dmitry Stogov 2021-10-11 16:56:07 +03:00
parent ccdda69a18
commit a4c41d45cd
2 changed files with 24 additions and 1 deletions

View File

@ -2518,7 +2518,7 @@ static zend_always_inline int _zend_update_type_info(
tmp |= MAY_BE_RCN;
}
}
if (opline->opcode != ZEND_QM_ASSIGN) {
if (opline->opcode == ZEND_COALESCE || opline->opcode == ZEND_JMP_SET) {
/* COALESCE and JMP_SET result can't be null */
tmp &= ~MAY_BE_NULL;
if (opline->opcode == ZEND_JMP_SET) {

View File

@ -0,0 +1,23 @@
--TEST--
JIT COPY_TMP: 001
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
opcache.protect_memory=1
--FILE--
<?php
function test() {
echo "";
}
$a = [];
$a[test()] ??= 1;
var_dump($a);
?>
--EXPECT--
array(1) {
[""]=>
int(1)
}