note 42615 deleted from security.globals by philip
| From: | philip@php.net | Date: | Wed, 14 Jul 2004 21:39:55 +0000 |
| Subject: | note 42615 deleted from security.globals by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73238@lists.php.net to get a copy of this message | ||
Note Submitter: jp
----
Matt AKA Junkie's code to unset possible global variables came in extremely useful for me
recently, so thanks for that, Matt! I did have to make a small change to get it to work though:
<?
$globals = array('_GET', '_POST', '_SERVER', '_FILE',
'_COOKIE', '_SESSION');
foreach ($globals as $i => $val) {
foreach ($$val as $j => $var) {
if (isset($$j)) {
unset($$j);
}
}
}
?>
You have to use the key ($j) rather than the value ($var) to unset the globals.
Cheers,
jp