Re: php 5.04 register_globals aint acting right.
| From: | Richard Lynch | Date: | Sat, 20 Aug 2005 03:50:25 +0000 |
| Subject: | Re: php 5.04 register_globals aint acting right. | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-220989@lists.php.net to get a copy of this message | ||
On Fri, August 19, 2005 2:14 am, Jochem Maas wrote:
> true. I was just pointing out how easy it is to 'fake'
> register_globals
> personally all my code currently runs this on init - because I don't
> like reg.globals at all:
>
> function unRegisterGlobals()
> {
> if (ini_get('register_globals')) {
> $SGs = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST,
> $_GET);
> if (isset($_SESSION)) { array_unshift($SGs, $_SESSION); }
>
> foreach ($SGs as $sg) {
> foreach ($superglobal as $k => $v) { unset($GLOBALS[ $k
> ]); }
> }
>
> ini_set('register_globals', false);
> }
> }
>
Like, if you are doing this before anything else in your script, I
*THINK* you could just do:
$GLOBALS = array();
instead of all that looping and stuff.
I don't THINK there are any variables you're not nuking anyway...
--
Like Music?
http://l-i-e.com/artists.htm