note 47024 deleted from faq.misc by aidan

From: Date: Thu, 25 Nov 2004 01:56:18 +0000
Subject: note 47024 deleted from faq.misc by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-80993@lists.php.net to get a copy of this message
Note Submitter: chris dot harper at allcomm dot co dot uk ---- The above snippet to emulate register_globals off appears to be incorrect. $global represents the value of a global, not its name. Therefore it should be: <?php // Emulate register_globals off if (ini_get('register_globals')) { $superglobals = array($_SERVER, $_ENV, $_FILES, $_COOKIE, $_POST, $_GET); if (isset($_SESSION)) { array_unshift($superglobals, $_SESSION); } foreach ($superglobals as $superglobal) { foreach ($superglobal as $name=>$global) { unset($GLOBALS[$name]); } } ini_set('register_globals', false); } ?> I have tested and used this script with success.

« previous php.notes (#80993) next »