Bug #68446 [ReO->Csd]: Array constant not accepted for array parameter default
Edit report at https://bugs.php.net/bug.php?id=68446&edit=1
ID: 68446
Updated by: stas@php.net
Reported by: ajf at ajf dot me
Summary: Array constant not accepted for array parameter
default
-Status: Re-Opened
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: OS X Yosemite
PHP Version: 5.6.3
Assigned To: bwoebi
Block user comment: N
Private report: N
New Comment:
oops, looks like I was too hasty
Previous Comments:
------------------------------------------------------------------------
[2014-11-23 22:51:53] stas@php.net
What about master branch? Was it intentionally not merged?
------------------------------------------------------------------------
[2014-11-23 22:51:24] bwoebi@php.net
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)
------------------------------------------------------------------------
[2014-11-23 20:11:35] bwoebi@php.net
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)
------------------------------------------------------------------------
[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
Thread (5 messages)