xref: /PHP-8.0/Zend/tests/bug73663.phpt (revision f8d79582)
1--TEST--
2Bug #73663 ("Invalid opcode 65/16/8" occurs with a variable created with list())
3--FILE--
4<?php
5function change(&$ref) {
6    $ref = range(1, 10);
7    return;
8}
9
10$func = function (&$ref) {
11    return change($ref);
12};
13
14$array = [1];
15var_dump(list($val) = $array); // NG: Invalid opcode
16
17change(list(&$val) = $array);
18var_dump($array);
19
20$array = [1];
21$func(list(&$val) = $array);
22var_dump($array);
23?>
24--EXPECT--
25array(1) {
26  [0]=>
27  int(1)
28}
29array(10) {
30  [0]=>
31  int(1)
32  [1]=>
33  int(2)
34  [2]=>
35  int(3)
36  [3]=>
37  int(4)
38  [4]=>
39  int(5)
40  [5]=>
41  int(6)
42  [6]=>
43  int(7)
44  [7]=>
45  int(8)
46  [8]=>
47  int(9)
48  [9]=>
49  int(10)
50}
51array(10) {
52  [0]=>
53  int(1)
54  [1]=>
55  int(2)
56  [2]=>
57  int(3)
58  [3]=>
59  int(4)
60  [4]=>
61  int(5)
62  [5]=>
63  int(6)
64  [6]=>
65  int(7)
66  [7]=>
67  int(8)
68  [8]=>
69  int(9)
70  [9]=>
71  int(10)
72}
73