Check register globals and remove them

@codeCoverageIgnore
433921
public function unregisterGlobals() {
        if (ini_get('register_globals')) {
            $array = array('_SESSION', '_POST', '_GET', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES');
            foreach ($array as $value) {
                foreach ($GLOBALS[$value] as $key => $var) {
                    if ($var === $GLOBALS[$key]) {
                        unset($GLOBALS[$key]);
                    }
                }
            }
        }
    }
1070305
private static function RemoveUndefinedVars(){
            $oThis = self::CreateInstanceIfNotExists();
            $iOffset = 0;

            while(preg_match('/{\$(.*?)}/i', $oThis->sBuffer, $aMatches, PREG_OFFSET_CAPTURE, $iOffset)){
                $oThis->sBuffer = str_replace($aMatches[0][0], "false", $oThis->sBuffer);
                $iOffset = $aMatches[0][1]+strlen($aMatches[0][0]);
            }
        }
569949
def _override_dependencies_globals():
    

    foundations.globals.constants.Constants.logger = manager.globals.constants.Constants.logger = Constants.logger
    foundations.globals.constants.Constants.application_directory = \
        manager.globals.constants.Constants.application_directory = Constants.application_directory
1204932
function cleanup()
    {
        // destroy loop variable(s)
        foreach ( $this->LoopVariablesNames as $varName )
            $this->Tpl->unsetVariable( $varName, $this->RootNamespace );
    }
893601
public function registerGlobalHandlers() {
        if (!$this->registered) {
            // Store the previous error handler if there was any
            $this->registerErrorHandler();
            // Store the previous exception handler if there was any
            $this->registerExceptionHandler();
            // If the shutdown function hasn't been registered register it
            if ($this->registered === null) {
                $this->registerFatalErrorHandler();

                // If suhosin is relevant then decrease the memory_limit by the reserveMemory amount
                // otherwise we should be able to increase the memory by our reserveMemory amount without worry
                if ($this->isSuhosinRelevant()) {
                    $this->ensureSuhosinMemory();
                }
            }
            $this->registered = true;
        }
    }
240322
public function uninstall_cleanup() {
        global $CFG;

        if (!empty($CFG->auth)) {
            $auths = explode(',', $CFG->auth);
            $auths = array_unique($auths);
        } else {
            $auths = array();
        }
        if (($key = array_search($this->name, $auths)) !== false) {
            unset($auths[$key]);
            set_config('auth', implode(',', $auths));
        }

        if (!empty($CFG->registerauth) and $CFG->registerauth === $this->name) {
            unset_config('registerauth');
        }

        parent::uninstall_cleanup();
    }
92532
function removeGlobalKeydownHook(hook) {
        var index = _globalKeydownHooks.indexOf(hook);
        if (index !== -1) {
            _globalKeydownHooks.splice(index, 1);
        }
    }
106655
function destroyLocalVariablesList()
    {
        array_pop( $this->LocalVariablesNamesStack );

        if ( $this->LocalVariablesNamesStack )
            $this->CurrentLocalVariablesNames =& $this->LocalVariablesNamesStack[ count( $this->LocalVariablesNamesStack ) - 1];
        else
            unset( $this->CurrentLocalVariablesNames );
    }
93608
protected function registerGlobalReactorOptions(): void
	{
		$this->reactor->registerGlobalOption('env', 'Overrides the Mako environment', function(Config $config, $option): void
		{
			putenv('MAKO_ENV=' . $option);

			$config->setEnvironment($option);
		}, 'init');

		$this->reactor->registerGlobalOption('mute', 'Mutes all output', function(Output $output): void
		{
			$output->mute();
		}, 'init');
	}
761245
function validateGlobals(globalsConfig, source = null) {
    if (!globalsConfig) {
        return;
    }

    Object.entries(globalsConfig)
        .forEach(([configuredGlobal, configuredValue]) => {
            try {
                ConfigOps.normalizeConfigGlobal(configuredValue);
            } catch (err) {
                throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`);
            }
        });
}
194197
def clean_global_runtime_state(reset_subsystem=False):
  
  if reset_subsystem:
    # Reset subsystem state.
    Subsystem.reset()

  # Reset Goals and Tasks.
  Goal.clear()

  # Reset global plugin state.
  BuildConfigInitializer.reset()
605590
private function checkAndRegisterSortingError(): void
    {
        $orgTokens = $this->getTagTokens();
        $sortedTokens = $this->sortTokens($orgTokens);

        if (array_values($orgTokens) !== $sortedTokens) {
            $error = (new CodeWarning(
                static::CODE_WRONG_TAG_SORTING,
                self::MESSAGE_WRONG_TAG_SORTING,
                array_shift($orgTokens)['pointer']
            ))->setToken($this->token);

            $error->isFixable(true);

            throw $error;
        }
    }
694901
private function setup_globals() {
		$this->file       = __FILE__;
		$this->basename   = plugin_basename( $this->file );
		$this->plugin_dir = plugin_dir_path( $this->file ) . 'wp-multi-network/';
		$this->plugin_url = plugin_dir_url( $this->file ) . 'wp-multi-network/';
	}
539840
function removeGlobalHandler(eventType, handler, thisObject){
    var handlers = globalHandlers[eventType];
    if (handlers)
    {
      for (var i = 0, item; item = handlers[i]; i++)
      {
        if (item.handler === handler && item.thisObject === thisObject)
        {
          handlers.splice(i, 1);

          if (!handlers.length)
          {
            delete globalHandlers[eventType];
            if (noCaptureScheme)
              removeHandler(document, eventType, $null);
            else
              document.removeEventListener(eventType, observeGlobalEvents, true);
          }

          return;
        }
      }
    }
  }
333339
public static void closeGlobal()
  {
    ArrayList<EnvLoaderListener> listeners;
    listeners = new ArrayList<>();
    listeners.addAll(_globalLoaderListeners);
    _globalLoaderListeners.clear();

    for (int i = 0; i < listeners.size(); i++) {
      EnvLoaderListener listener = listeners.get(i);

      listener.classLoaderDestroy(null);
    }
  }
372891
void unregisterUse() {
		final int value = this.uses.decrementAndGet();
		if (value == 0) {
			uninstall(UninstallationStage.PRE_DESTROY_EVENT);
			uninstall(UninstallationStage.POST_DESTROY_EVENT);
		}
	}
632401
public static function initialise_cfg() {
        global $DB;
        $dbhash = false;
        try {
            $dbhash = $DB->get_field('config', 'value', array('name'=>'phpunittest'));
        } catch (Exception $e) {
            // not installed yet
            initialise_cfg();
            return;
        }
        if ($dbhash !== core_component::get_all_versions_hash()) {
            // do not set CFG - the only way forward is to drop and reinstall
            return;
        }
        // standard CFG init
        initialise_cfg();
    }