PHP Classes


Recommend this page to a friend!

      MySQL Session  >  All threads  >  gc_maxlifetime  >  (Un) Subscribe thread alerts  
Summary:problem about gc_maxlifetime
Author:gurel kaynak
Date:2006-09-10 18:25:15
Update:2006-09-10 18:59:34

  1. gc_maxlifetime   Reply   Report abuse  
Picture of gurel kaynak gurel kaynak - 2006-09-10 18:25:15
This is a good class, but isnt it still dependent to gc_maxlifetime for the session lifetime? Because when you get the id with session_id() function it returns it from the php default sessions, and if the session is deleted by the gc you can't get the right session id. So you lose your session data. You have to change your php.ini settings to correct the situation.

I havent tested it yet but this is what i think will happen... Maybe i missed something and im wrong...

Any thoughts?

  2. Re: gc_maxlifetime   Reply   Report abuse  
Picture of Julien PACHET Julien PACHET - 2006-09-10 18:59:34 - In reply to message 1 from gurel kaynak

Yes, because my class is a layer beyond the PHP session system, when PHP garbage the session id, my session lost the connection. But you could make a system recover like this:

* The user lost the connection between his session and his id
* So, the user reconnect
* Then, when the user get his user id, you could parse the session data to recover his data and put them into his new session.

My class have a lifetime that can be longer than PHP lifetime session.
Before the lifetime end, all the data are in the table in serialize format.

Therefore, your remark is good, and maybe I will improve my class with your reflection...