Skip to content

Commit ac4a475

Browse files
committed
Use dedicated param name in SQL stmt
1 parent 2b5ea65 commit ac4a475

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
@@ -217,16 +217,18 @@ public function removeExpired(): void
217217
{
218218
$accessTokenTableName = $this->getTableName();
219219
$refreshTokenTableName = $this->database->applyPrefix(RefreshTokenRepository::TABLE_NAME);
220+
$now = $this->helpers->dateTime()->getUtc()->format(DateFormatsEnum::DB_DATETIME->value);
220221

221222
// Delete expired access tokens, but only if the corresponding refresh token is also expired.
222223
$this->database->write(
223224
"DELETE FROM $accessTokenTableName WHERE expires_at < :now AND
224225
NOT EXISTS (
225226
SELECT 1 FROM {$refreshTokenTableName}
226-
WHERE $accessTokenTableName.id = $refreshTokenTableName.access_token_id AND expires_at > :now
227+
WHERE $accessTokenTableName.id = $refreshTokenTableName.access_token_id AND expires_at > :now2
227228
)",
228229
[
229-
'now' => $this->helpers->dateTime()->getUtc()->format(DateFormatsEnum::DB_DATETIME->value),
230+
'now' => $now,
231+
'now2' => $now,
230232
],
231233
);
232234
}

0 commit comments

Comments
 (0)