PHP Superglobals Hack

I’ve added my superglobals hack to tasks. The code looks like this:

This file ( is included in each function that references a superglobal:

// for PHP versions < 4.1, will use the // vars defined in if (!$_REQUEST || !$_SESSION || !$_SERVER || !$_COOKIE) { global $_REQUEST, $_SESSION, $_SERVER, $_COOKIE; } ?>

The superglobals are defined in another file ( which is included at the top of the rendering pages:

if (!$_REQUEST) {
$_REQUEST = array_merge($_REQUEST, $HTTP_POST_VARS);
if (!$_SESSION) {
if (!$_SERVER) {
if (!$_COOKIE) {

You can include the $_POST, $_GET and $_FILES vars (etc.) if you use them.

This all seems to work, if you know of a problem with this technique, post a comment or let me know