RE: [PHP] HTTP_POST_VARS not set.

From: Date: Thu, 20 Jun 2002 02:16:24 +0000
Subject: RE: [PHP] HTTP_POST_VARS not set.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-103061@lists.php.net to get a copy of this message
> register_globals does not affect the existence > of $HTTP_POST_VARS. If it is for you then this > is a serious bug :). I'm guessing it's something > else. Hmmm, wasn't sure about this so I went and checked at www.php.net. In the release notes for 4.2.1 I found the following: "We would also like to attend you on a big change in PHP 4.2.0 concerning variable handling. External variables (from the environment, the HTTP request, cookies or the web server) are no longer registered in the global scope by default. The preferred method of accessing these external variables is by using the new Superglobal arrays, introduced in PHP 4.1.0." Now, I take this to mean that $HTTP_POST_VARS is no longer part of the global scope and, that some other means must be used. The same page refers to the manual section on predefined variables that also includes the following warning: "In PHP 4.2.0 and later, the default set of predefined variables which are available in the global scope has changed. Individual input and server variables are by default no longer placed directly into the global scope; rather, they are placed into the following superglobal arrays. You can still force the old behaviour by setting register_globals to 'On' in your php.ini file." From which I would say that register_globals might well be the solution to a problem with HTTP_POST_VARS suddenly not working. Then there's this information from the reserved variables section of the manual: "HTTP POST variables: $_POST Note: Introduced in 4.1.0. In earlier versions, use $HTTP_POST_VARS. An associative array of variables passed to the current script via the HTTP POST method. Automatically global in any scope. This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_POST; to access it within functions or methods, as you do with $HTTP_POST_VARS. $HTTP_POST_VARS contains the same initial information, but is not an autoglobal. (Note that HTTP_POST_VARS and $_POST are different variables and that PHP handles them as such) If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_POST and $HTTP_POST_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals." So, back to your statement: > register_globals does not affect the existence > of $HTTP_POST_VARS. If it is for you then this > is a serious bug :). I'm guessing it's something > else. In the current iteration of php I think that register_globals does indeed affect the existence of HTTP_POST_VARS - indeed, according to the php manual HTTP_POST_VARS is deprecated and you should now be using $_POST instead. CYA, Dave

« previous php.general (#103061) next »