xref: /PHP-7.1/Zend/tests/bug68446.phpt (revision 113213f0)
1--TEST--
2Bug #68446 (Array constant not accepted for array parameter default)
3--FILE--
4<?php
5const FOO = [1];
6const BAR = null;
7
8function a(array $a = FOO) {
9	var_dump($a);
10}
11
12function b(array $b = BAR) {
13	var_dump($b);
14}
15
16b(null);
17b([]);
18b();
19a([]);
20a();
21a(null);
22?>
23--EXPECTF--
24NULL
25array(0) {
26}
27NULL
28array(0) {
29}
30array(1) {
31  [0]=>
32  int(1)
33}
34
35Fatal error: Uncaught TypeError: Argument 1 passed to a() must be of the type array, null given, called in %s on line %d and defined in %s:%d
36Stack trace:
37#0 %s(%d): a(NULL)
38#1 {main}
39  thrown in %s on line %d
40