Bug #14952 Updated: $_GET and $HTTP_GET_VARS are separate arrays
| From: | jan@php.net | Date: | Wed, 09 Jan 2002 17:43:22 +0000 |
| Subject: | Bug #14952 Updated: $_GET and $HTTP_GET_VARS are separate arrays | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76373@lists.php.net to get a copy of this message | ||
ID: 14952
Updated by: jan
Reported By: ramses0@yahoo.com
Old Status: Open
Status: Bogus
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 4.1.1
New Comment:
the $_* arrays are intended to be seperate from ther $HTTP_*_VARS
arrays.
The new arrays are so called "super-global". You don't hve to introduce
them nito function-scope with global. This is a feature no bug => Bogus
Previous Comments:
------------------------------------------------------------------------
[2002-01-09 12:38:13] ramses0@yahoo.com
blah.php
<?php
print_r( $HTTP_GET_VARS );
print_r( $_GET );
echo "<hr>";
$_GET['test'] = 1;
echo "<hr>";
print_r( $HTTP_GET_VARS );
print_r( $_GET );
?>
Results from blah.php
---------------------
Array ( ) Array ( )
Array ( ) Array ( [test] => 1 )
Results from blah.php?test=test
---------------------
Array ( [test] => test ) Array ( [test] => test )
Array ( [test] => test ) Array ( [test] => 1 )
Aside from the performance/memory implications of having two separate
arrays (ie: http://blah.com/blah.php?text=[shakespeare]&spell_check=1),
it's really annoying when trying to propagate information to a
moduralized script which normally takes data off the get-string.
Here is my patch: $_GET =& $HTTP_GET_VARS; It halves the memory
requirements of PHP's default arrays, and behaves much closer to what an
end-user would expect. I am willing to bet that NOBODY wants
$_GET['blah'] = 'test'; echo $HTTP_GET_VARS['blah']; to fail in
mysterious ways.
Why is this not done in the first place? I have checked on the mailing
lists and in the bug archives, but couldn't find any previous
discussion. Send me an email at ramses0@yahoo.com if there is a good
reason for this, or if I am missing something important.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14952&edit=1