php-src/Zend/tests/coalesce_assign_optimization.phpt
Nikita Popov b6b820e532 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix COPY_TMP live range construction with optimization
2021-11-11 10:36:54 +01:00

21 lines
320 B
PHP

--TEST--
Live range construction should not break if coalesce assign branch is optimized away
--FILE--
<?php
function test() {
$a[X] ??= Y;
var_dump($a);
}
function test2(string $b, int $c) {
$a[~$b] ??= $c;
}
define('X', 1);
define('Y', 2);
test();
test2("", 0);
?>
--EXPECT--
array(1) {
[1]=>
int(2)
}