Creak Creak - 8 months ago 39
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

will always be passed to its
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?


Yes, it will be passed automatically.

There's no reason to think otherwise.