# Session

- Thread: https://externals.io/message/7370
- Original archive: https://news-web.php.net/php.internals/7370
- Started by Lukas Smith on 2004-01-28T10:50:27+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #7370 — Lukas Smith — 2004-01-28T10:50:27+00:00

URL: https://externals.io/message/7370#7370

Hi,

I am moving to the php internal session system and there are a number of 
stumbling blocks I want to bring up. Since I am new to the session 
system (I have read a few articles about it and writtten some code using 
it) I want to take the opportunity to discuss things here a bit before I 
submit feature requests :-)

Specifically I am looking at adding my own session handler. The only 
reason for now to do so is that I want to extend the garbage collection 
to also delete a few other files that are generated over the coure of a 
session in my framework.

1) selective handler overwrite
Unfortunately you cannot selectively overwrite the session handler and 
the defeault callbacks are not exposed to the user as function, so I 
have to reimplement the entire file handler even if I just want to 
modify the garbage/destroy callbacks.

2) custom session handler and `session_destroy()`
The next stumbling block was tricky to find out. The pointer was in the 
user comments. Appearently if you call session_destroy the user defined 
session handler is forgotten. Even worse there is no way to get the 
session handler which means that whatever code section calls 
session_destroy (in my case PEAR::LiveUser) on logout needs to have the 
information about what custom session handler (what if any) to use.

Interestingly the user defined session handler is not forgotten entirely 
as the session handling fails to load from here on forth until I set the 
session handler again.

So it would be good to either not have the session handler forgotten 
when calling `session_destroy()` or if this is not feasible for some 
reason to have atleast a session_get_save_handler() function to get the 
handler if one is set so that it can easily be restored.

gruss,
Lukas Smith
smith@backendmedia.com
_______________________________
   BackendMedia
   www.backendmedia.com
   berlin@backendmedia.com

   Linn Zwoch Smith GbR
   Pariser Str. 44
   D-10707 Berlin

   Tel +49 30 83 22 50 00
   Fax +49 30 83 22 50 07
