1--TEST--
2"Reference Unpacking - Oddities" list()
3--FILE--
4<?php
5$a = 1;
6$b =& $a;
7$arr = [&$a, &$b];
8list(&$a, &$b) = $arr;
9var_dump($a, $b, $arr);
10$b++;
11var_dump($a, $b, $arr);
12unset($a, $b, $arr);
13
14/*
15 * $a is first set as a reference to the 0'th elem, '1'
16 * $a is then set to the value of the 1'st elem, '2'
17 * $arr would look like, [2,2]
18 * Increment $a, and it should be [3, 2]
19 */
20$arr = [1, 2];
21list(&$a, $a) = $arr;
22var_dump($a);
23$a++;
24var_dump($arr);
25unset($a, $arr);
26
27/*
28 * We do not allow references to the same variable of rhs.
29 */
30$a = [1, 2];
31$ref =& $a;
32list(&$a, &$b) = $a;
33var_dump($a, $b);
34$a++; $b++;
35var_dump($ref);
36?>
37--EXPECT--
38int(1)
39int(1)
40array(2) {
41  [0]=>
42  &int(1)
43  [1]=>
44  &int(1)
45}
46int(2)
47int(2)
48array(2) {
49  [0]=>
50  &int(2)
51  [1]=>
52  &int(2)
53}
54int(2)
55array(2) {
56  [0]=>
57  &int(3)
58  [1]=>
59  int(2)
60}
61int(1)
62int(2)
63array(2) {
64  [0]=>
65  &int(2)
66  [1]=>
67  &int(3)
68}
69