Skip to content

Commit 4aeba6f

Browse files
committed
refactor: reuse variable
1 parent c9e2042 commit 4aeba6f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

system/Session/Handlers/RedisHandler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,15 @@ public function gc($max_lifetime)
266266
*/
267267
protected function lockSession(string $sessionID): bool
268268
{
269+
$lockKey = $this->keyPrefix . $sessionID . ':lock';
270+
269271
// PHP 7 reuses the SessionHandler object on regeneration,
270272
// so we need to check here if the lock key is for the
271273
// correct session ID.
272-
if ($this->lockKey === $this->keyPrefix . $sessionID . ':lock') {
274+
if ($this->lockKey === $lockKey) {
273275
return $this->redis->expire($this->lockKey, 300);
274276
}
275277

276-
$lockKey = $this->keyPrefix . $sessionID . ':lock';
277278
$attempt = 0;
278279

279280
do {

0 commit comments

Comments
 (0)