php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24276 GLOBALS array doesn't seem to work
Submitted: 2003-06-21 04:55 UTC Modified: 2003-06-23 13:19 UTC
From: joemiggs82 at yahoo dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.2 OS: Solaris 8 & 9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: joemiggs82 at yahoo dot com
New email:
PHP Version: OS:

 

 [2003-06-21 04:55 UTC] joemiggs82 at yahoo dot com
Description:
------------
Assuming register_globals is turned off in the php.ini file, the $GLOBALS variable array will then be used in accessing variables defined in the script.

In our case, this doesn't seem to work.

Reproduce code:
---------------
<html>
<body>
<a href="thisfile.php?nav=MORE">Click me for more!</a>
<?
if($GLOBALS["nav"]=="MORE")
{
echo "You just clicked for more!";
}
else
{
?>
<?
}
?>
</body>
</html>


Expected result:
----------------
Before:

Click me for more!

After clicking:

Click me for more!
You just clicked for more!

Actual result:
--------------
Before:

Click me for more!

After clicking:

Click me for more!


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-21 04:59 UTC] derick@php.net
Register_globals = off makes PHP *not* register globals, so they don't end up in $GLOBALS, use $_GET or $_POST to access them ddepending on your HTTP Request Method.
 [2003-06-21 05:03 UTC] alan_k@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.

$_POST or $_GET or $_REQUEST...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 22 00:00:02 2025 UTC