You are here

function drupal_unset_globals in Drupal 4

Same name and namespace in other branches
  1. 5 includes/bootstrap.inc \drupal_unset_globals()
  2. 6 includes/bootstrap.inc \drupal_unset_globals()

Unsets all disallowed global variables. See $allowed for what's allowed.

1 call to drupal_unset_globals()
_drupal_bootstrap in includes/bootstrap.inc

File

includes/bootstrap.inc, line 136
Functions that need to be loaded on every Drupal request.

Code

function drupal_unset_globals() {
  if (ini_get('register_globals')) {
    $allowed = array(
      '_ENV' => 1,
      '_GET' => 1,
      '_POST' => 1,
      '_COOKIE' => 1,
      '_FILES' => 1,
      '_SERVER' => 1,
      '_REQUEST' => 1,
      'access_check' => 1,
      'GLOBALS' => 1,
    );
    foreach ($GLOBALS as $key => $value) {
      if (!isset($allowed[$key])) {
        unset($GLOBALS[$key]);
      }
    }
  }
}