[HttpFoundation] get currently session.gc_maxlifetime if ttl doesnt exists
This commit is contained in:
parent
bfe697bb86
commit
b6253e2336
@ -63,7 +63,7 @@ class RedisSessionHandler extends AbstractSessionHandler
|
||||
|
||||
$this->redis = $redis;
|
||||
$this->prefix = $options['prefix'] ?? 'sf_s';
|
||||
$this->ttl = $options['ttl'] ?? (int) ini_get('session.gc_maxlifetime');
|
||||
$this->ttl = $options['ttl'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,7 +79,7 @@ class RedisSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
protected function doWrite($sessionId, $data): bool
|
||||
{
|
||||
$result = $this->redis->setEx($this->prefix.$sessionId, $this->ttl, $data);
|
||||
$result = $this->redis->setEx($this->prefix.$sessionId, (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')), $data);
|
||||
|
||||
return $result && !$result instanceof ErrorInterface;
|
||||
}
|
||||
@ -115,6 +115,6 @@ class RedisSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
public function updateTimestamp($sessionId, $data)
|
||||
{
|
||||
return (bool) $this->redis->expire($this->prefix.$sessionId, $this->ttl);
|
||||
return (bool) $this->redis->expire($this->prefix.$sessionId, (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user