Re: php 5.04 register_globals aint acting right.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux