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--SKIPIF--
9<?php require_once('skipif.inc'); ?>
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
84
85function array_access_undef() {
86    $ao = new ArrayObject;
87    $ao[0] = $undef;
88    var_dump($ao[0]);
89}
90
91array_access_undef();
92
93?>
94--EXPECTF--
95array(1) {
96  [0]=>
97  int(1)
98}
99array(1) {
100  [0]=>
101  bool(true)
102}
103array(1) {
104  [0]=>
105  array(0) {
106  }
107}
108Cannot add element to the array as the next element is already occupied
109object(ArrayObject)#%d (1) {
110  ["storage":"ArrayObject":private]=>
111  array(2) {
112    [2]=>
113    int(1)
114    ["a"]=>
115    int(2)
116  }
117}
118array(1) {
119  [0]=>
120  array(2) {
121    [0]=>
122    int(1)
123    [1]=>
124    int(1)
125  }
126}
127Illegal offset type
128array(1) {
129  [0]=>
130  array(2) {
131    [0]=>
132    int(1)
133    [1]=>
134    int(1)
135  }
136}
137array(1) {
138  [0]=>
139  array(2) {
140    [0]=>
141    int(1)
142    [1]=>
143    int(1)
144  }
145}
146Cannot use a scalar value as an array
147int(1)
148
149Warning: Undefined variable $undef in %s on line %d
150NULL
151