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

From: Date: Sun, 23 Nov 2014 22:58:07 +0000
Subject: Bug #68446 [Csd]: Array constant not accepted for array parameter default
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188764@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:             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:

Yeah, sorry. It took me some time to figure out how to port that fix to master. Had to basically
reimplement the whole thing for master.


Previous Comments:
------------------------------------------------------------------------
[2014-11-23 22:53:30] stas@php.net

oops, looks like I was too hasty

------------------------------------------------------------------------
[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)

« previous php.bugs (#188764) next »