Question
Speaking of $_REQUEST, everyone knows that it is a collection of $_GET and $_POST. But if you are interested, check the documentation and you will see:
$_REQUEST
An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE.
It is said here that $_REQUEST defaults to a collection of $_GET, $_POST, and $_COOKIE. As a result, I used my local php to check and found that there were only $_GET, $_POST, and no $_COOKIE! ! Could it be that the documentation is wrong?
Answer
In fact, there is an explanation in the changelog:
Version 5.3 and above, there is a request_order attribute in php.ini to set $_REQUEST. After checking php.ini, request_order is set to GP (Get and Post).
request_order’s official website description:
request_order string
This directive describes the order in which PHP registers GET, POST and Cookie variables into the _REQUEST array. Registration is done from left to right, newer values override older values.
If this directive is not set, variables_order is used for $_REQUEST contents.
Note that the default distribution php.ini files does not contain the 'C' for cookies, due to security concerns.
It turns out that G, P, and C represent Get, Post, and Cookie respectively. In version 5.3 and above, request_order is set to GP by default and does not include C, that is, $_REQUEST only contains $_GET and $_POST by default!! (So The official website documentation is somewhat misleading).
Also, the order of G, P, C is the covering order of the set array.
As a reminder, if you are using fpm-php for experiments, you need to restart php-fpm after changing php.ini