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];
9var_dump([PHP_INT_MAX-1 => 0, ...$arr]);
10
11var_dump([PHP_INT_MAX-1 => 0, ...[1, 2, 3]]);
12
13const ARR = [1, 2, 3];
14const ARR2 = [PHP_INT_MAX-1 => 0, ...ARR];
15var_dump(ARR2);
16
17?>
18--EXPECTF--
19Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
20array(2) {
21  [9223372036854775806]=>
22  int(0)
23  [9223372036854775807]=>
24  int(1)
25}
26
27Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
28array(2) {
29  [9223372036854775806]=>
30  int(0)
31  [9223372036854775807]=>
32  int(1)
33}
34
35Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
36array(2) {
37  [9223372036854775806]=>
38  int(0)
39  [9223372036854775807]=>
40  int(1)
41}
42