coalesce_assign_optimization.phpt 319 B

123456789101112131415161718192021
  1. --TEST--
  2. Live range construction should not break if colesce assign branch is optimized away
  3. --FILE--
  4. <?php
  5. function test() {
  6. $a[X] ??= Y;
  7. var_dump($a);
  8. }
  9. function test2(string $b, int $c) {
  10. $a[~$b] ??= $c;
  11. }
  12. define('X', 1);
  13. define('Y', 2);
  14. test();
  15. test2("", 0);
  16. ?>
  17. --EXPECT--
  18. array(1) {
  19. [1]=>
  20. int(2)
  21. }