Skip to content

Commit f83e530

Browse files
Wickexnicolas-grekas
authored andcommitted
[Cache] Fixed incorrect usage of UNLINK with PHPRedis with Redis < 4.0
1 parent e457627 commit f83e530

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Session/Storage/Handler/RedisSessionHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ protected function doDestroy(string $sessionId): bool
9393

9494
if ($unlink) {
9595
try {
96-
$this->redis->unlink($this->prefix.$sessionId);
97-
98-
return true;
96+
$unlink = false !== $this->redis->unlink($this->prefix.$sessionId);
9997
} catch (\Throwable $e) {
10098
$unlink = false;
10199
}
102100
}
103101

104-
$this->redis->del($this->prefix.$sessionId);
102+
if (!$unlink) {
103+
$this->redis->del($this->prefix.$sessionId);
104+
}
105105

106106
return true;
107107
}

0 commit comments

Comments
 (0)