Creak Creak - 13 days ago 5
PHP Question

Is SessionHandler::gc()'s $maxlifetime argument passed automatically on internal execution?

When implementing my own session handler can I be sure that a $maxlifetime argument corresponding to the PHPRC's

gc_maxlifetimevalue
will always be passed to its
gc()
method if it's called internally?

As an example, could this happen:

// Set before a session is started.
ini_set('session.gc_maxlifetime', 60);


// GC is called by session_start() based on probability settings.
public function gc($maxlifetime)
{
// $maxlifetime has no value


or do I need to implement a value check/set a default?

Answer

Yes, it will be passed automatically.

There's no reason to think otherwise.

Comments