php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24547 can't send name of global array as function parameter
Submitted: 2003-07-08 15:42 UTC Modified: 2003-07-08 17:48 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: nn at rtfm dot cz Assigned:
Status: Not a bug Package: Variables related
PHP Version: Irrelevant OS: Linux Debian
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nn at rtfm dot cz
New email:
PHP Version: OS:

 

 [2003-07-08 15:42 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-08 15:49 UTC] jf at rtfm dot cz
wtf php?
 [2003-07-08 15:53 UTC] 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 17:48 UTC] wez@php.net
You can't access super-globals via variable-variables.

http://www.php.net/manual/en/language.variables.variable.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC