From 88eb7d68a7723af5ba41436e89586b12c2a6a408 Mon Sep 17 00:00:00 2001 From: Zankaria Date: Sun, 14 Jul 2024 19:13:51 +0200 Subject: [PATCH] bans.php: do not deserialize post that does not exist --- inc/bans.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/bans.php b/inc/bans.php index 975bf462..7e3a1408 100644 --- a/inc/bans.php +++ b/inc/bans.php @@ -72,7 +72,7 @@ class Bans { static private function findSingleNoGc($ban_id) { $query = prepare( 'SELECT ``bans``.* FROM ``bans`` - WHERE ``bans``.id = :id + WHERE ``bans``.id = :id AND ip ORDER BY `expires` IS NULL, `expires` DESC LIMIT 1' ); @@ -84,7 +84,9 @@ class Bans { if ($query->rowCount() == 0) { return null; } else { - $ret['post'] = json_decode($ret['post'], true); + if ($ret['post']) { + $ret['post'] = json_decode($ret['post'], true); + } return $ret; } }