note 42274 added to security.globals
| From: | MattAKAJunkie at rn2 dot php dot net | Date: | Mon, 10 May 2004 17:36:51 +0000 |
| Subject: | note 42274 added to security.globals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69425@lists.php.net to get a copy of this message | ||
Think of this situation: you're writing an open-source program and there comes the threat of
whether or not the end-user will have register_globals off because many free and still many paid
hosts have it on by default. Using ini_set() might seem like a good idea, but it doesn't always
work. Instead, it's better to just unset all possible global variables (like $PHP_SELF for
example).
<?
$globals = array('_GET', '_POST', '_SERVER', '_FILE',
'_COOKIE', '_SESSION');
// add more as desired
foreach ($globals as $i => $val)
{
foreach ($$val as $j => $var)
{
if (isset($$var)) { unset($$var); }
}
}
// This will unset any potential globals registered
?>
----
Manual Page -- http://www.php.net/manual/en/security.globals.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42274
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42274&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42274&report=yes
Search -- http://master.php.net/manage/user-notes.php