Skip to content

Commit 8f2816a

Browse files
committed
Use dedicated param name in SQL stmt
1 parent 86e51cd commit 8f2816a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Repositories/AccessTokenRepository.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,18 @@ public function removeExpired(): void
148148
{
149149
$accessTokenTableName = $this->getTableName();
150150
$refreshTokenTableName = $this->database->applyPrefix(RefreshTokenRepository::TABLE_NAME);
151+
$now = TimestampGenerator::utc()->format('Y-m-d H:i:s');
151152

152153
// Delete expired access tokens, but only if the corresponding refresh token is also expired.
153154
$this->database->write(
154155
"DELETE FROM $accessTokenTableName WHERE expires_at < :now AND
155156
NOT EXISTS (
156157
SELECT 1 FROM {$refreshTokenTableName}
157-
WHERE $accessTokenTableName.id = $refreshTokenTableName.access_token_id AND expires_at > :now
158+
WHERE $accessTokenTableName.id = $refreshTokenTableName.access_token_id AND expires_at > :now2
158159
)",
159160
[
160-
'now' => TimestampGenerator::utc()->format('Y-m-d H:i:s'),
161+
'now' => $now,
162+
'now2' => $now,
161163
],
162164
);
163165
}

0 commit comments

Comments
 (0)