1--TEST--
2Appending to an array via unpack may fail
3--SKIPIF--
4<?php if (PHP_INT_SIZE != 8) die("skip 64bit only"); ?>
5--FILE--
6<?php
7
8$arr = [1, 2, 3];
9try {
10    var_dump([PHP_INT_MAX-1 => 0, ...$arr]);
11} catch (Error $e) {
12    echo $e->getMessage(), "\n";
13}
14
15try {
16    var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]);
17} catch (Error $e) {
18    echo $e->getMessage(), "\n";
19}
20
21const ARR = [1, 2, 3];
22function test($x = [PHP_INT_MAX-1 => 0, ...ARR]) {}
23try {
24    test();
25} catch (Error $e) {
26    echo $e->getMessage(), "\n";
27}
28
29?>
30--EXPECT--
31Cannot add element to the array as the next element is already occupied
32Cannot add element to the array as the next element is already occupied
33Cannot add element to the array as the next element is already occupied
34