From 9b0e6ecb712ee1f6d431ce9c2b654e3c7303a551 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 30 Jun 2026 18:53:32 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20PHP=207.4=20compat=20=E2=80=94=20remove?= =?UTF-8?q?=20union=20return=20types=20from=20session=20handler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- middleware/DbSessionHandler.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/middleware/DbSessionHandler.php b/middleware/DbSessionHandler.php index 08d028e..fd5021c 100644 --- a/middleware/DbSessionHandler.php +++ b/middleware/DbSessionHandler.php @@ -5,10 +5,10 @@ class DbSessionHandler implements SessionHandlerInterface { private const TTL = 86400 * 30; // 30 days - public function open(string $path, string $name): bool { return true; } + public function open($path, $name): bool { return true; } public function close(): bool { return true; } - public function read(string $id): string|false + public function read($id): string { $stmt = db()->prepare("SELECT data FROM sessions WHERE id = ? AND updated_at > DATE_SUB(NOW(), INTERVAL " . self::TTL . " SECOND)"); $stmt->execute([$id]); @@ -16,23 +16,23 @@ class DbSessionHandler implements SessionHandlerInterface return $row ? $row['data'] : ''; } - public function write(string $id, string $data): bool + public function write($id, $data): bool { db()->prepare("INSERT INTO sessions (id, data) VALUES (?, ?) ON DUPLICATE KEY UPDATE data = VALUES(data), updated_at = NOW()") ->execute([$id, $data]); return true; } - public function destroy(string $id): bool + public function destroy($id): bool { db()->prepare("DELETE FROM sessions WHERE id = ?")->execute([$id]); return true; } - public function gc(int $max_lifetime): int|false + public function gc($max_lifetime): int { $stmt = db()->prepare("DELETE FROM sessions WHERE updated_at < DATE_SUB(NOW(), INTERVAL ? SECOND)"); $stmt->execute([self::TTL]); - return $stmt->rowCount(); + return (int)$stmt->rowCount(); } }