note 62381 added to security.globals
| From: | rn214 at cam dot ac dot uk | Date: | Mon, 27 Feb 2006 13:39:12 +0000 |
| Subject: | note 62381 added to security.globals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104485@lists.php.net to get a copy of this message | ||
If you have a server with register_globals = On, and you want to simulate turning it off, then there
is a serious problem with $_SESSION.
To fix it, you must do
$unset = array_keys($_SESSION);
foreach($unset as $rg_var){
if(isset($$rg_var)){
unset($$rg_var);
}
}
AFTER you have called session_start().
Otherwise, you will have pairs of variables $_SESSION["foo"] and $foo
which are "hard-linked" together. They are not simply initialised to the same value:
modifying $_SESSION["foo"] will also modify $foo.
----
Server IP: 85.116.0.130
Probable Submitter: 81.187.40.226
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/security.globals.php
Edit -- http://master.php.net/note/edit/62381
Del: integrated -- http://master.php.net/note/delete/62381/integrated
Del: useless -- http://master.php.net/note/delete/62381/useless
Del: bad code -- http://master.php.net/note/delete/62381/bad+code
Del: spam -- http://master.php.net/note/delete/62381/spam
Del: non-english -- http://master.php.net/note/delete/62381/non-english
Del: in docs -- http://master.php.net/note/delete/62381/in+docs
Del: other reasons-- http://master.php.net/note/delete/62381
Reject -- http://master.php.net/note/reject/62381
Search -- http://master.php.net/manage/user-notes.php