Creak Creak - 1 year ago 59
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?

Answer Source

Yes, it will be passed automatically.

There's no reason to think otherwise.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download