File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ #69017 (Fail to push to the empty array with the constant value defined in class scope)
3
+ --FILE--
4
+ <?php
5
+
6
+ class c1
7
+ {
8
+ const ZERO = 0 ;
9
+ const ONE = 1 ;
10
+ const MAX = PHP_INT_MAX ;
11
+ public static $ a1 = array (self ::ONE => 'one ' );
12
+ public static $ a2 = array (self ::ZERO => 'zero ' );
13
+ public static $ a3 = array (self ::MAX => 'zero ' );
14
+ }
15
+
16
+
17
+ c1::$ a1 [] = 1 ;
18
+ c1::$ a2 [] = 1 ;
19
+ c1::$ a3 [] = 1 ;
20
+
21
+ var_dump (c1::$ a1 );
22
+ var_dump (c1::$ a2 );
23
+ var_dump (c1::$ a3 );
24
+ ?>
25
+ --EXPECTF--
26
+ Warning: Cannot add element to the array as the next element is already occupied in %sbug69017.php on line %d
27
+ array(2) {
28
+ [1]=>
29
+ string(3) "one"
30
+ [2]=>
31
+ int(1)
32
+ }
33
+ array(2) {
34
+ [0]=>
35
+ string(4) "zero"
36
+ [1]=>
37
+ int(1)
38
+ }
39
+ array(1) {
40
+ [%d]=>
41
+ string(4) "zero"
42
+ }
You can’t perform that action at this time.
0 commit comments