[thelist] php: difference between post vars?

Simon Willison cs1spw at bath.ac.uk
Thu Aug 7 04:38:09 CDT 2003


Hi Paul,

Thursday, August 7, 2003, 12:16:17 AM, you wrote:
>> There's an additional different: $_POST (and $_GET and family) are
>> super-globals - they are available at all times, even inside
>> functions. $HTTP_POST_VARS (which is deprecated and should not be
>> used)
>>
> this needs to be qualified - it should not be used *if your php version 
> is 4.3 +*, if you use $_POST / $_GET under a previous php version, they 
> are not recognised as either superglobal or representative of the post 
> or get vars array

Actually $_POST, $_GET etc were introduced in PHP 4.1.0 back in
December 2001. There have been some important security fixes since
that version, so anyone still running it should upgrade as a matter
of urgency. It's still better to write your code to use $_GET and
$_POST - if you need it to run on an older install for some reason
you can always add the following lines at the top:

$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;

Bare in mind though that this will lose you the super globals
functionality, so you'll have to add global $_GET; statements to the
top of any functions that need to access those arrays.

Cheers,

Simon
-- 
http://simon.incutio.com/



More information about the thelist mailing list