note 42615 added to security.globals
| From: | jp at rn2 dot php dot net | Date: | Sun, 23 May 2004 23:09:42 +0000 |
| Subject: | note 42615 added to security.globals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70004@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/security.globals.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42615
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42615&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42615&report=yes
Search -- http://master.php.net/manage/user-notes.php