Bug #68446 [Opn->Csd]: Array constant not accepted for array parameter default

From: Date: Sun, 23 Nov 2014 20:11:36 +0000
Subject: Bug #68446 [Opn->Csd]: Array constant not accepted for array parameter default
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188757@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68446&edit=1 ID: 68446 Updated by: bwoebi@php.net Reported by: ajf at ajf dot me Summary: Array constant not accepted for array parameter default -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: OS X Yosemite PHP Version: 5.6.3 Block user comment: N Private report: N New Comment: Automatic comment on behalf of bobwei9@hotmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=5ef138b0c7c4e9532e205f45c18a72aa1d279c24 Log: Fix bug #68446 (bug with constant defaults and type hints) Previous Comments: ------------------------------------------------------------------------ [2014-11-18 22:27:40] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68446&edit=1

« previous php.bugs (#188757) next »