note 83963 added to function.session-write-close
| From: | lee at osu1 dot php dot net | Date: | Fri, 20 Jun 2008 14:35:53 +0000 |
| Subject: | note 83963 added to function.session-write-close | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140623@lists.php.net to get a copy of this message | ||
It seems that the session data is written out when there is actual changes to the array.
class Login(){
function logoff(){
session_unset();
@session_destroy();
@session_start();
$_SESSION = array();
session_commit();
}
}
//during test, this doesn't work and the session data remain.
classLoginObject->logoff();
//I fix it like this
class Login(){
function logoff(){
session_unset();
@session_destroy();
@session_start();
$_SESSION = array();
$_SESSION['cleardata'] = 1; <------
unset($_SESSION['cleardata']);<------
session_commit();
}
}
//after the fix, this works and the session is empty.
classLoginObject->logoff();
I was using phpunit(Sebastian Bergmann) to do my test.
----
Server IP: 64.71.164.2
Probable Submitter: 209.219.239.2
----
Manual Page -- http://www.php.net/manual/en/function.session-write-close.php
Edit -- https://master.php.net/note/edit/83963
Del: integrated -- https://master.php.net/note/delete/83963/integrated
Del: useless -- https://master.php.net/note/delete/83963/useless
Del: bad code -- https://master.php.net/note/delete/83963/bad+code
Del: spam -- https://master.php.net/note/delete/83963/spam
Del: non-english -- https://master.php.net/note/delete/83963/non-english
Del: in docs -- https://master.php.net/note/delete/83963/in+docs
Del: other reasons-- https://master.php.net/note/delete/83963
Reject -- https://master.php.net/note/reject/83963
Search -- https://master.php.net/manage/user-notes.php