Skip to content

Commit c2062ca

Browse files
committed
Added test for #69017
1 parent f2940b7 commit c2062ca

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

Zend/tests/bug69017.phpt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}

0 commit comments

Comments
 (0)