xref: /PHP-7.4/Zend/tests/bug69017.phpt (revision c2062ca4)
1--TEST--
2#69017 (Fail to push to the empty array with the constant value defined in class scope)
3--FILE--
4<?php
5
6class 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
17c1::$a1[] = 1;
18c1::$a2[] = 1;
19c1::$a3[] = 1;
20
21var_dump(c1::$a1);
22var_dump(c1::$a2);
23var_dump(c1::$a3);
24?>
25--EXPECTF--
26Warning: Cannot add element to the array as the next element is already occupied in %sbug69017.php on line %d
27array(2) {
28  [1]=>
29  string(3) "one"
30  [2]=>
31  int(1)
32}
33array(2) {
34  [0]=>
35  string(4) "zero"
36  [1]=>
37  int(1)
38}
39array(1) {
40  [%d]=>
41  string(4) "zero"
42}
43