Re: Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only
| From: | Michael Morris | Date: | Thu, 09 Dec 2010 19:58:08 +0000 |
| Subject: | Re: Deprecating "global" + $GLOBALS, making $_REQUEST, $_GET, $_POST read-only | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50976@lists.php.net to get a copy of this message | ||
On removing globals / $GLOBALS, erm, -1 to that. Just too much legacy code
needs this to work as is.
On making $_POST, $_REQUEST, $_GET et al read only, again -1 for the same
reason. However, I understand the sentiment and it brings up this idea...
What about a new superglobal, $_INPUT, that is read only.
Further its topmost structure could go something like this --
$_INPUT = array (
'POST' => array(), // The post request vars
'COOKIE' => array(), // Cookies
'GET' => array(), // Get request vars
'HEADERS' => array(), // Inbound HTTP headers, the stuff that right now is
misleadingly in $_SERVER['HTTP...']
'FILES' => array(), // Uploaded file information.
);
Since $_INPUT would be read only from inception nothing can break because it
can't be written to. At an INI level the option to turn off the legacy
superglobals it replaces might be added, but that's a separate issue.