mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

The use may be optimized away, leaving us only with the free use. Also fix off-by-one error in the other optimization case.
21 lines
319 B
PHP
21 lines
319 B
PHP
--TEST--
|
|
Live range construction should not break if colesce 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)
|
|
}
|