|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21149 array assignment and HTTP_*_VARS
Submitted: 2002-12-22 17:04 UTC Modified: 2002-12-29 15:02 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: tharbad at kaotik dot org Assigned: iliaa (profile)
Status: Closed Package: Variables related
PHP Version: 4.3.0-dev/4.4.0-dev OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tharbad at kaotik dot org
New email:
PHP Version: OS:


 [2002-12-22 17:04 UTC] tharbad at kaotik dot org
While doing a security audit on a PHP web app, I was able to bypass a variable check wich later allowed me to remotely execute commands on the web server. Although this was a programming error, I found it very odd the behaviour from PHP.
Consider the following code as an example:

if ( isset($HTTP_GET_VARS['test']) ||
        isset($HTTP_POST_VARS['test']) ||
        isset($HTTP_COOKIE_VARS['test']) ) {
                echo "not allowed\r\n";
else echo "test not defined, proceed\r\n";

echo "<pre>";
echo "test HTTP_GET_VARS: ".$HTTP_GET_VARS['test'];
echo "\r\n";
echo "var test: $test\r\n";
echo "\r\n";

Having this, and requesting the page as:

The output will be:

test not defined in HTTP_*_VARS
var test: Array

So, 'test' is an array, but appears as no set in HTTP_*_VARS.


Joao Gouveia



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-23 18:50 UTC]
Updated description.
 [2002-12-29 15:02 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Sep 22 01:03:37 2021 UTC