1--TEST--
2JIT ASSIGN_DIM: 002
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_buffer_size=1M
8--EXTENSIONS--
9opcache
10--FILE--
11<?php
12function foo() {
13    $var[] = 1;
14    var_dump($var);
15}
16foo();
17
18function foo1() {
19    $var1[] = true;
20    var_dump($var1);
21}
22foo1();
23
24function foo2() {
25    $var2[] = array();
26    var_dump($var2);
27}
28foo2();
29
30function foo3() {
31    $array = array(PHP_INT_MAX => "dummy");
32    try {
33        $array[] = array();
34    } catch (Error $e) {
35        echo $e->getMessage(), "\n";
36    }
37
38    $array = new ArrayObject();
39    $array[index()] = 1;
40    $array[offset()] = 2;
41
42    var_dump($array);
43}
44foo3();
45
46function index() {
47    return 2;
48}
49
50function offset() {
51    return "a";
52}
53
54function foo4() {
55    $array = array();
56    $array[] = array();
57    $array[0][] = 1;
58    $array[0][1] = 1;
59    var_dump($array);
60
61    try {
62        $array[function() {}] = 2;
63    } catch (Error $e) {
64        echo $e->getMessage(), "\n";
65    }
66    var_dump($array);
67
68    $array2[][] = 3;
69    var_dump($array);
70}
71foo4();
72
73function foo5() {
74    $a = 1;
75    try {
76        $a[2] = 1;
77    } catch (Error $e) {
78        echo $e->getMessage(), "\n";
79    }
80    return $a;
81}
82var_dump(foo5());
83
84function false_to_array($a) {
85    var_dump($a[2] = 1);
86    return $a;
87}
88function false_to_array_append($a) {
89    var_dump($a[] = 1);
90    return $a;
91}
92function false_to_array_invalid_index($a) {
93    var_dump($a[[]] = 1);
94    return $a;
95}
96function false_to_array_nested($a) {
97    var_dump($a[2][3] = 1);
98    return $a;
99}
100function false_to_array_nested_append($a) {
101    var_dump($a[][] = 1);
102    return $a;
103}
104function false_to_array_nested_invalid_index($a) {
105    var_dump($a[[]][0] = 1);
106    return $a;
107}
108var_dump(false_to_array(false));
109var_dump(false_to_array_append(false));
110try {
111    var_dump(false_to_array_invalid_index(false));
112} catch (Error $e) {
113    echo $e->getMessage(), "\n";
114}
115var_dump(false_to_array_nested(false));
116var_dump(false_to_array_nested_append(false));
117try {
118    var_dump(false_to_array_nested_invalid_index(false));
119} catch (Error $e) {
120    echo $e->getMessage(), "\n";
121}
122
123function array_access_undef() {
124    $ao = new ArrayObject;
125    $ao[0] = $undef;
126    var_dump($ao[0]);
127}
128
129array_access_undef();
130?>
131--EXPECTF--
132array(1) {
133  [0]=>
134  int(1)
135}
136array(1) {
137  [0]=>
138  bool(true)
139}
140array(1) {
141  [0]=>
142  array(0) {
143  }
144}
145Cannot add element to the array as the next element is already occupied
146object(ArrayObject)#%d (1) {
147  ["storage":"ArrayObject":private]=>
148  array(2) {
149    [2]=>
150    int(1)
151    ["a"]=>
152    int(2)
153  }
154}
155array(1) {
156  [0]=>
157  array(2) {
158    [0]=>
159    int(1)
160    [1]=>
161    int(1)
162  }
163}
164Illegal offset type
165array(1) {
166  [0]=>
167  array(2) {
168    [0]=>
169    int(1)
170    [1]=>
171    int(1)
172  }
173}
174array(1) {
175  [0]=>
176  array(2) {
177    [0]=>
178    int(1)
179    [1]=>
180    int(1)
181  }
182}
183Cannot use a scalar value as an array
184int(1)
185
186Deprecated: Automatic conversion of false to array is deprecated in %s
187int(1)
188array(1) {
189  [2]=>
190  int(1)
191}
192
193Deprecated: Automatic conversion of false to array is deprecated in %s on line %d
194int(1)
195array(1) {
196  [0]=>
197  int(1)
198}
199
200Deprecated: Automatic conversion of false to array is deprecated in %s on line %d
201Illegal offset type
202
203Deprecated: Automatic conversion of false to array is deprecated in %s on line %d
204int(1)
205array(1) {
206  [2]=>
207  array(1) {
208    [3]=>
209    int(1)
210  }
211}
212
213Deprecated: Automatic conversion of false to array is deprecated in %s on line %d
214int(1)
215array(1) {
216  [0]=>
217  array(1) {
218    [0]=>
219    int(1)
220  }
221}
222
223Deprecated: Automatic conversion of false to array is deprecated in %s on line %d
224Illegal offset type
225
226Warning: Undefined variable $undef in %s on line %d
227NULL
228