summaryrefslogtreecommitdiff
path: root/Zend/tests/array_literal_next_element_error.phpt
blob: 23dec5e22cae2d920b1dcb99adba09a67f85ba5b (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
--TEST--
Next free element may overflow in array literals
--FILE--
<?php

$i = PHP_INT_MAX;
try {
    $array = [$i => 42, new stdClass];
    var_dump($array);
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

function test($x = [PHP_INT_MAX => 42, "foo"]) {}
try {
    test();
} catch (Error $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
Cannot add element to the array as the next element is already occupied
Cannot add element to the array as the next element is already occupied