#25341 [Bgs]: Parse error if using server variables as default function argument value
| From: | derick@php.net | Date: | Mon, 01 Sep 2003 12:04:21 +0000 |
| Subject: | #25341 [Bgs]: Parse error if using server variables as default function argument value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-46999@lists.php.net to get a copy of this message | ||
ID: 25341
Updated by: derick@php.net
Reported By: martin at lucas-smith dot co dot uk
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Win2K
PHP Version: 4.3.3
New Comment:
Yes, this is deliberate because it's hard to chose from which scope to
pick the variables from (calling, or called). Don't bother with a
feature request, it won't be changed anyway.
Derick
Previous Comments:
------------------------------------------------------------------------
[2003-09-01 07:03:02] martin at lucas-smith dot co dot uk
Is this a deliberate restriction? It seems a perfectly reasonable thing
to want to do. Perhaps this is a feature request then..
------------------------------------------------------------------------
[2003-09-01 06:58:09] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
It has nothing to do with it being a superglobal or not. You just can
ONLY use constants as default values.
Derick
------------------------------------------------------------------------
[2003-09-01 06:57:02] martin at lucas-smith dot co dot uk
Description:
------------
Is there some reason why a $_GET or other server variable cannot be
included directly within a function declaration, as its default value?
If using the reproduce code below I get a parse error:
Parse error: parse error, unexpected T_VARIABLE in [scriptaddress] on
line [linenumber]
Reproduce code:
---------------
function queryParameters ($queryString = $_GET['QUERY_STRING'])
{
# Do something with $queryString
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25341&edit=1