Bathmat
Bathmat

Reputation: 663

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?

Upvotes: 1

Views: 233

Answers (1)

Narf
Narf

Reputation: 14752

Yes, it will be passed automatically.

There's no reason to think otherwise.

Upvotes: 1

Related Questions