From 8e2fb18c339cee3bd26cfd41d611a6d4238d3666 Mon Sep 17 00:00:00 2001 From: Alex Stoica Date: Sun, 7 Jan 2018 04:10:13 +0200 Subject: [PATCH 1/4] Fix warning count in Ranking Fix Warning: count(): Parameter must be an array or an object that implements Countable in GameEngine/Ranking.php on line 279 --- GameEngine/Ranking.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index 0c807229..b77b11cf 100755 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -271,6 +271,8 @@ ORDER BY totalpop DESC, totalvillages DESC, userid DESC"; } + $datas = array(); + $result = (mysqli_query($GLOBALS['link'],$q)); while($row = mysqli_fetch_assoc($result)) { $datas[] = $row; From bea610cfde811dc93099e44b9f285da5b1f1aae0 Mon Sep 17 00:00:00 2001 From: Alex Stoica <0x01.alex@gmail.com> Date: Sat, 6 Jan 2018 05:26:26 +0000 Subject: [PATCH 2/4] Fix PHP 7.2 non-countable types --- GameEngine/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 0c0268be..c89fa727 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5461,7 +5461,7 @@ References: User ID/Message ID, Mode $q = "SELECT * FROM " . TB_PREFIX . "movement, " . TB_PREFIX . "attacks where " . TB_PREFIX . "movement.`" . $where . "` IN(".implode(', ', $village).") and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 3 or " . TB_PREFIX . "movement.`" . $where . "` IN(".implode(', ', $village).") and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 4 ORDER BY endtime ASC"; break; default: - return null; + return []; } $result = $this->mysqli_fetch_all(mysqli_query($this->dblink,$q)); From 4c16c0178174d8cdf37ec61b09e29f84c1a42963 Mon Sep 17 00:00:00 2001 From: Alex Stoica <0x01.alex@gmail.com> Date: Sat, 6 Jan 2018 05:41:30 +0000 Subject: [PATCH 3/4] Fix more PHP 7.2 non-countable types --- GameEngine/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index c89fa727..c0457754 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -678,7 +678,7 @@ class MYSQLi_DB implements IDbConnection { $arrayVariable[$arrayStructure] = []; } - if (isset($arrayVariable[$arrayStructure]) && count($arrayVariable[$arrayStructure])) { + if (isset($arrayVariable[$arrayStructure]) && !empty($arrayVariable[$arrayStructure])) { return $arrayVariable[$arrayStructure]; } else { return null; From 7b67bed84e32523295f99d765e4e5a45038c1468 Mon Sep 17 00:00:00 2001 From: Alex Stoica <0x01.alex@gmail.com> Date: Sun, 7 Jan 2018 03:07:07 +0000 Subject: [PATCH 4/4] Fix multiSort create_function is deprecated in PHP 7.2 --- GameEngine/Multisort.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GameEngine/Multisort.php b/GameEngine/Multisort.php index 97b03d19..8935c470 100755 --- a/GameEngine/Multisort.php +++ b/GameEngine/Multisort.php @@ -43,8 +43,10 @@ class multiSort { $t = 'strnatcmp($a[' . $key . '], $b[' . $key . '])'; break; } - usort($array, create_function('$a, $b', 'return ' . ($order ? '' : '-') . '(' . $t . ');')); + usort($array, function($a, $b) use ($order, $t) { + return ($order ? '' : '-') . ($t); + }); } return $array; }