From 3b97d6b302adf299120652bc7902d61ecc0c97bc Mon Sep 17 00:00:00 2001 From: The Kabal Date: Mon, 20 Sep 2021 08:56:43 -0400 Subject: [PATCH] Improvements thanks to Scrutinizer --- classes/Db.php | 2 +- classes/KabalHunt.php | 1 - classes/KabalToPlanet.php | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/classes/Db.php b/classes/Db.php index f70a7ad8..aa8ece06 100644 --- a/classes/Db.php +++ b/classes/Db.php @@ -69,7 +69,6 @@ public function initAdodb(): object $db_host .= ":$db_port"; } - $old_db = new \stdClass(); // Attempt to connect to the database try { @@ -107,6 +106,7 @@ public function initAdodb(): object throw new \Exception($err_msg); } + $old_db->prefix = null; $old_db->prefix = $db_prefix; // End of database work return $old_db; diff --git a/classes/KabalHunt.php b/classes/KabalHunt.php index 3238bd1b..5156526d 100644 --- a/classes/KabalHunt.php +++ b/classes/KabalHunt.php @@ -29,7 +29,6 @@ class KabalHunt public static function hunt(\PDO $pdo_db, string $lang, array $playerinfo, int $kabalisdead, Registry $tkireg): void { $langvars = Translate::load($pdo_db, $lang, array('main')); - $targetinfo = array(); $sql = "SELECT COUNT(*) AS num_players FROM ::prefix::ships WHERE ship_destroyed='N' AND email NOT LIKE '%@kabal' AND ship_id > 1"; $stmt = $pdo_db->prepare($sql); diff --git a/classes/KabalToPlanet.php b/classes/KabalToPlanet.php index 77b42270..9a6f6c47 100644 --- a/classes/KabalToPlanet.php +++ b/classes/KabalToPlanet.php @@ -352,7 +352,7 @@ public static function planet(\PDO $pdo_db, string $lang, int $planet_id, Regist $shiplist = $stmt->fetchAll(\PDO::FETCH_ASSOC); $i = 0; - if (is_array($shiplist)) + if ($shiplist !== false) { foreach ($shiplist as $onplanet) {