#24547 [Opn->Bgs]: can't send name of global array as function parameter
| From: | wez@php.net | Date: | Tue, 08 Jul 2003 22:48:44 +0000 |
| Subject: | #24547 [Opn->Bgs]: can't send name of global array as function parameter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-43491@lists.php.net to get a copy of this message | ||
ID: 24547
Updated by: wez@php.net
Reported By: nn at rtfm dot cz
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Linux Debian
PHP Version: Irrelevant
New Comment:
You can't access super-globals via variable-variables.
http://www.php.net/manual/en/language.variables.variable.php
Previous Comments:
------------------------------------------------------------------------
[2003-07-08 15:53:07] spaze at exploited dot cz
workaround - this way it works, but..
function foo($type='_GET') {
global $$type; // note this
print_r($$type);
}
looks like a "superglobal access" problem?
------------------------------------------------------------------------
[2003-07-08 15:49:11] jf at rtfm dot cz
wtf php?
------------------------------------------------------------------------
[2003-07-08 15:42:22] nn at rtfm dot cz
Description:
------------
I think that this is a bug, see the code, it is self-explaining :-)
Reproduce code:
---------------
function xx ($type = '_POST') {
echo '<pre>'; print_r($$type); echo '</pre>';
}
xx();
Expected result:
----------------
I expect to see my $_POST variables! :-)
Actual result:
--------------
Notice: Undefined variable: _POST in
/www/album.cz/www/album/registrace/index.php on line 31
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24547&edit=1