summaryrefslogtreecommitdiff
path: root/Zend/tests/array_literal_next_element_error.phpt
blob: 8b4af3caddd64406b0d9833b8d2d12b93412e759 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--TEST--
Next free element may overflow in array literals
--FILE--
<?php

$i = PHP_INT_MAX;
$array = [$i => 42, new stdClass];
var_dump($array);

const FOO = [PHP_INT_MAX => 42, "foo"];
var_dump(FOO);

?>
--EXPECTF--
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
array(1) {
  [%d]=>
  int(42)
}

Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
array(1) {
  [%d]=>
  int(42)
}