Skip to content

Commit b6253e2

Browse files
rafaeltovarnicolas-grekas
authored andcommitted
[HttpFoundation] get currently session.gc_maxlifetime if ttl doesnt exists
1 parent bfe697b commit b6253e2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function __construct($redis, array $options = [])
6363

6464
$this->redis = $redis;
6565
$this->prefix = $options['prefix'] ?? 'sf_s';
66-
$this->ttl = $options['ttl'] ?? (int) ini_get('session.gc_maxlifetime');
66+
$this->ttl = $options['ttl'] ?? null;
6767
}
6868

6969
/**
@@ -79,7 +79,7 @@ protected function doRead($sessionId): string
7979
*/
8080
protected function doWrite($sessionId, $data): bool
8181
{
82-
$result = $this->redis->setEx($this->prefix.$sessionId, $this->ttl, $data);
82+
$result = $this->redis->setEx($this->prefix.$sessionId, (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')), $data);
8383

8484
return $result && !$result instanceof ErrorInterface;
8585
}
@@ -115,6 +115,6 @@ public function gc($maxlifetime): bool
115115
*/
116116
public function updateTimestamp($sessionId, $data)
117117
{
118-
return (bool) $this->redis->expire($this->prefix.$sessionId, $this->ttl);
118+
return (bool) $this->redis->expire($this->prefix.$sessionId, (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')));
119119
}
120120
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy