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

From: Date: Sun, 23 Nov 2014 22:51:54 +0000
Subject: Bug #68446 [Csd->ReO]: Array constant not accepted for array parameter default
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188762@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:         stas@php.net
 Reported by:        ajf at ajf dot me
 Summary:            Array constant not accepted for array parameter
                     default
-Status:             Closed
+Status:             Re-Opened
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   OS X Yosemite
 PHP Version:        5.6.3
-Assigned To:        
+Assigned To:        bwoebi
 Block user comment: N
 Private report:     N

 New Comment:

What about master branch? Was it intentionally not merged?


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#188762) next »