xref: /php-src/Zend/tests/gh11016.phpt (revision ede8adb2)
1--TEST--
2GH-11016 (Heap buffer overflow in ZEND_ADD_ARRAY_UNPACK_SPEC_HANDLER)
3--FILE--
4<?php
5function number() {
6    return 6;
7}
8
9// We need to use a function to trick the optimizer *not* to optimize the array to a constant
10$x = [number() => 0, ...[1, 1, 1]];
11print_r($x);
12?>
13--EXPECT--
14Array
15(
16    [6] => 0
17    [7] => 1
18    [8] => 1
19    [9] => 1
20)
21