note 64270 deleted from function.session-destroy by bjori
| From: | bjori@php.net | Date: | Tue, 11 Apr 2006 11:39:26 +0000 |
| Subject: | note 64270 deleted from function.session-destroy by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107757@lists.php.net to get a copy of this message | ||
Note Submitter: mvdvis at raketnet dot nl
----
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();
?>