note 110969 added to function.session-unset
| From: | mwgamera at gmail dot com | Date: | Mon, 31 Dec 2012 17:42:53 +0000 |
| Subject: | note 110969 added to function.session-unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192715@lists.php.net to get a copy of this message | ||
There is nothing magical about the $_SESSION superglobal and unsetting it.
One has simply to remember that all the session_* functions will use continue to
use exactly that instance of array that was set up by session_start.
Consider this example:
<?php
session_start();
var_dump($_SESSION);
$a =& $_SESSION;
unset($_SESSION);
$a['x'] = 1; // $a refers to the original $_SESSION
$_SESSION['x'] = 2; // new unrelated array
session_write_close();
// saved session contains x => 1
----
Server IP: 46.17.113.3
Probable Submitter: 82.210.166.126
----
Manual Page -- http://php.net/manual/en/function.session-unset.php
Edit -- https://master.php.net/note/edit/110969
Del: integrated -- https://master.php.net/note/delete/110969/integrated
Del: useless -- https://master.php.net/note/delete/110969/useless
Del: bad code -- https://master.php.net/note/delete/110969/bad+code
Del: spam -- https://master.php.net/note/delete/110969/spam
Del: non-english -- https://master.php.net/note/delete/110969/non-english
Del: in docs -- https://master.php.net/note/delete/110969/in+docs
Del: other reasons-- https://master.php.net/note/delete/110969
Reject -- https://master.php.net/note/reject/110969
Search -- https://master.php.net/manage/user-notes.php