PDA

View Full Version : $_REQUEST overwrite order?



djr33
12-18-2006, 11:59 AM
Random thought, and not related to a particular situation, but I'm curious about how $_REQUEST is generated.

It's a superglobal array composed of $_GET, POST, and COOKIE (plus $_FILES in PHP 4.1- or something).

If you have a variable with the same name in two or more of the different bits, then, how does it work? Which is loaded first (then overwritten), and which is last (therefore there in the end)?

simonf
12-18-2006, 12:22 PM
Hi

Found this:
$_REQUEST

Variables provided to the script via the GET, POST, and COOKIE input mechanisms, and which therefore cannot be trusted. The presence and order of variable inclusion in this array is defined according to the PHP variables_order (http://www.php.net/manual/en/ini.core.php#ini.variables-order) configuration directive. This array has no direct analogue in versions of PHP prior to 4.1.0. See also import_request_variables() (http://www.php.net/manual/en/function.import-request-variables.php).

Caution

Since PHP 4.3.0, FILE information from $_FILES does not exist in $_REQUEST.

Note: When running on the command line , this will not include the argv and argc entries; these are present in the $_SERVER array.

djr33
12-18-2006, 12:53 PM
Alright, thanks.

I'm aware of the security issues, and I prefer using $_GET, etc. anyway, but I was just wondering about this.