note 64270 added to function.session-destroy

From: Date: Tue, 11 Apr 2006 10:02:29 +0000
Subject: note 64270 added to function.session-destroy
Groups: php.notes 
Request: Send a blank email to php-notes+get-107744@lists.php.net to get a copy of this message
When you use session_set_save_handler to add a custom session handler, you must reset your custom session handler after destroying the session. When you don't reset the handler you get: Fatal error: session_start(): Failed to initialize storage module <?php class session { // My session handler } $session = new session(); session_set_save_handler(array(&$session,"open"), array(&$session,"close"), array(&$session,"read"), array(&$session,"write"), array(&$session,"destroy"), array(&$session,"gc")); session_start(); session_destroy(); // Reset the session handler to my custom handler after destroying the session. session_set_save_handler(array(&$session,"open"), array(&$session,"close"), array(&$session,"read"), array(&$session,"write"), array(&$session,"destroy"), array(&$session,"gc")); session_start(); ?> ---- Server IP: 83.137.20.120 Probable Submitter: 62.216.23.76 ---- 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/function.session-destroy.php Edit -- http://master.php.net/note/edit/64270 Del: integrated -- http://master.php.net/note/delete/64270/integrated Del: useless -- http://master.php.net/note/delete/64270/useless Del: bad code -- http://master.php.net/note/delete/64270/bad+code Del: spam -- http://master.php.net/note/delete/64270/spam Del: non-english -- http://master.php.net/note/delete/64270/non-english Del: in docs -- http://master.php.net/note/delete/64270/in+docs Del: other reasons-- http://master.php.net/note/delete/64270 Reject -- http://master.php.net/note/reject/64270 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107744) next »