Merge branch 'PHP-8.1'

* PHP-8.1:
  Fixed type inference for COPY_TMP
This commit is contained in:
Dmitry Stogov 2021-10-11 16:56:49 +03:00
commit 176c319109
2 changed files with 24 additions and 1 deletions

View File

@ -2584,7 +2584,7 @@ static zend_always_inline zend_result _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)
}