php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15478 problem referencing $_GET using a variable
Submitted: 2002-02-09 18:25 UTC Modified: 2002-06-19 15:20 UTC
From: pguillot at paanjaru dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.1.1 OS: Linux
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: pguillot at paanjaru dot com
New email:
PHP Version: OS:

 

 [2002-02-09 18:25 UTC] pguillot at paanjaru dot com
It seems that it is not possible to reference the $_GET, $_POST, etc using
a variable as in (A) :
$var_get = '_GET';
$local_get = $$var_get;

$var_http_get = 'HTTP_GET_VARS';
$local_http_get = $$var_http_get;

Now if the requested url contains &something=12

print $local_http_get['something'] . '*';     // print the string '12*'
print $local_get['something'] . '*';   // print the string '*'

But if (B) :
$var_good=&$_GET;
$var_get = $$var_good;
print $local_get['something'] . '*';   // print the string '12*'

Would it be a problem trying to reference a variable which name starts
with an underscore ?

I use this kind of syntax to check if something not allowed exists in the url,
using an array like $to_check = array( '_GET', '_POST' );

Anyway, as it's possible to use an alternative syntax (B), it is
not a __big__ problem, after all !

Keep on with a so nice job, I am still amazed about the power and speed
of Php, after more than 2 years using it, in a production environment.

Thanks a lot, and have a nice day. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-18 19:22 UTC] sniper@php.net
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


 [2002-06-19 15:20 UTC] pguillot at paanjaru dot com
Ahem .. sniper
Is it a joke or an automated response ?
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 15:00:01 2026 UTC