Bug #62182 [Com]: Default Parameter not to be $_GET or $_POST
| From: | nikic@php.net | Date: | Tue, 29 May 2012 17:12:32 +0000 |
| Subject: | Bug #62182 [Com]: Default Parameter not to be $_GET or $_POST | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-170909@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62182&edit=1
ID: 62182
Comment by: nikic@php.net
Reported by: noel_fb at hotmail dot com
Summary: Default Parameter not to be $_GET or $_POST
Status: Open
Type: Bug
Package: *General Issues
Operating System: Red Hat
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
This has nothing to do with $_GET or $_POST. Default arguments simply can only be static scalars,
variables are not allowed in general.
Previous Comments:
------------------------------------------------------------------------
[2012-05-29 11:56:00] noel_fb at hotmail dot com
Description:
------------
Hello.
Try:
function prueba($metodos = array($_GET, $_POST)){
}
or
function prueba($metodos = array($_GET)){
}
ERROR:
Parse error: syntax error, unexpected T_VARIABLE, expecting ')' in
/var/www/html/app/xxx/xxx.php on line xx
Test script:
---------------
Try:
function prueba($metodos = array($_GET, $_POST)){
}
or
function prueba($metodos = array($_GET)){
}
ERROR:
Parse error: syntax error, unexpected T_VARIABLE, expecting ')' in
/var/www/html/app/xxx/xxx.php on line xx
Expected result:
----------------
Not error
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62182&edit=1