TracNav menu
Control The Session
To implement security features patSession realizes three functions to control the session's live span. These are destroy, restart and fork.
Rest In Peace
The destroy function is sort of a panic reaction for paranoid programmers. That it does is quite simple: it empties the session storage container and end the current session.
Everything stored in session is nil and you can neither receive session values nor save new ones. After a session has been destroyed, it can only be revived with restart. Even though, the memory loss remains (which is intended behavior).
$sess['box'] = 'Jack'; $sess->destroy(); echo 'I can\' t recall who is in the box: ' . $sess['box'] . '<br />'; $sess->restart(); echo 'Still, there ain\'t no Jack in the box: ' . . $sess['box'] . '<br />';
Reincarnation
As mentioned above, the only way to revive a destroyed session is to restart it. Still this doesn't save and values. At least you can continue using the session object. Of course, you need to refill all the session values etc.
Clone
The fork method allows you to deep copy the values of a current session to another one. In scope of sessions, forking means to create a new session id which starts as an exact copy of the old one.
Of course, forking a session is only possible for active sessions.
