Bug #62182 [Opn->Nab]: Default Parameter not to be $_GET or $_POST

From: Date: Wed, 30 May 2012 02:24:02 +0000
Subject: Bug #62182 [Opn->Nab]: Default Parameter not to be $_GET or $_POST
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-170915@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 Updated by: laruence@php.net Reported by: noel_fb at hotmail dot com Summary: Default Parameter not to be $_GET or $_POST -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Red Hat PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2012-05-29 17:16:41] noel_fb at hotmail dot com Oh! I understand. I'm sory for the fail. Saludos! from Argentina! ------------------------------------------------------------------------ [2012-05-29 17:12:32] nikic@php.net This has nothing to do with $_GET or $_POST. Default arguments simply can only be static scalars, variables are not allowed in general. ------------------------------------------------------------------------ [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

« previous php.bugs (#170915) next »