note 82542 deleted from security.globals by cmb

From: Date: Sun, 17 Jan 2021 13:56:44 +0000
Subject: note 82542 deleted from security.globals by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216174@lists.php.net to get a copy of this message
Note Submitter: Dice ---- To expand on the nice bit of code Mike Willbanks wrote and Alexander tidied up, I turned the whole thing in a function that removes all the globals added by register_globals so it can be implemented in an included functions.php and doesn't litter the main pages too much. <?php //Undo register_globals function unregister_globals() { if (ini_get(register_globals)) { $array = array('_REQUEST', '_SESSION', '_SERVER', '_ENV', '_FILES'); foreach ($array as $value) { foreach ($GLOBALS[$value] as $key => $var) { if ($var === $GLOBALS[$key]) { unset($GLOBALS[$key]); } } } } } ?>

« previous php.notes (#216174) next »