Array constant not accepted for array parameter default
[2014-11-18 22:27 UTC] ajf at ajf dot me
Description:
------------
I made a constant array and tried to use it as the default for an array parameter, but it wouldn't accept it.
Test script:
---------------
<?php
const FOO = [];
function foobar(array $foo = FOO) {}
Actual result:
--------------
Fatal error: Default value for parameters with array type hint can only be an array or NULL in %s on line 5
Process exited with code 255.
[2014-11-23 22:51 UTC] stas@php.net
-Status: Closed +Status: Re-Opened -Assigned To: +Assigned To: bwoebi
[2014-11-23 22:51 UTC] stas@php.net
[2014-11-23 22:53 UTC] stas@php.net
-Status: Re-Opened +Status: Closed
[2014-11-23 22:53 UTC] stas@php.net
[2014-11-23 22:58 UTC] bwoebi@php.net