Merge branch 'PHP-8.1'

* PHP-8.1:
  Fix refcount inferemce ($a += $a returns old array with RCN)
This commit is contained in:
Dmitry Stogov 2021-12-06 11:32:02 +03:00
commit ebb7b173b0
2 changed files with 23 additions and 1 deletions

View File

@ -2636,7 +2636,7 @@ static zend_always_inline zend_result _zend_update_type_info(
ssa, opline->extended_value, t1, t2,
opline->opcode == ZEND_ASSIGN_OP ? ssa_op->op1_def : -1, optimization_level);
if (tmp & (MAY_BE_STRING|MAY_BE_ARRAY)) {
tmp |= MAY_BE_RC1;
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
}
if (tmp & (MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;

View File

@ -0,0 +1,22 @@
--TEST--
JIT ASSIGN_OP: 008 Arrays merging with itself
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
function test() {
$a = [];
for ($i = 0; $i < 2; $i++) {
$a + $a += $a;
$a['b'] += 1;
}
}
test();
?>
DONE
--EXPECTF--
Warning: Undefined array key "b" in %sassign_op_008.php on line 6
DONE