bug71030.phpt 354 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #71030: Self-assignment in list() may have inconsistent behavior
  3. --FILE--
  4. <?php
  5. function test1() {
  6. $a = [1, 2];
  7. $c =& $a;
  8. list($c, $b) = $a;
  9. var_dump($a, $b);
  10. }
  11. function test2() {
  12. $a = [1, 2];
  13. $_a = "a";
  14. list($$_a, $b) = $a;
  15. var_dump($a, $b);
  16. }
  17. test1();
  18. test2();
  19. ?>
  20. --EXPECT--
  21. int(1)
  22. int(2)
  23. int(1)
  24. int(2)