diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index a8cdcd25..e199ac65 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1842,7 +1842,7 @@ class Automation { //type of attack $type = $dataarray[$data_num]['attack_type']; - if($type == 1) $scout = 1; + $scout = ($type == 1) ? 1 : 0; $ud = ($def_tribe - 1) * 10; $att_ab = $database->getABTech($data['from']); // Blacksmith level @@ -1941,7 +1941,7 @@ class Automation { //type of attack $type = $dataarray[$data_num]['attack_type']; - if($type == 1) $scout = 1; + $scout = ($type == 1) ? 1 : 0; $att_ab1 = $att_ab2 = $att_ab3 = $att_ab4 = $att_ab5 = $att_ab6 = $att_ab7 = $att_ab8 = 0; $def_ab[31] = $def_ab[32] = $def_ab[33] = $def_ab[34] = $def_ab[35] = $def_ab[36] = $def_ab[37] = $def_ab[38] = 0; @@ -2082,7 +2082,7 @@ class Automation { $info_cat = $info_chief = $info_ram = $info_hero = ","; //check to see if can destroy village - if (count($varray) > 1 && !$database->villageHasArtefact($DefenderWref) && !$to['natar']) { + if (count($varray) > 1 && !$database->villageHasArtefact($DefenderWref) && empty($to['natar'])) { $can_destroy = 1; } else $can_destroy = 0; diff --git a/GameEngine/Database.php b/GameEngine/Database.php index fc4dd3f5..d294f4e9 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -6130,12 +6130,12 @@ $q = "INSERT INTO ".TB_PREFIX."demolition VALUES ( $end = ( $ownertribe * 10 ); for ( $i = $start; $i <= $end; $i ++ ) { - $totalunits += $movingunits[ 'u' . $i ]; - $totalunits += $reinforcingunits[ 'u' . $i ]; + $totalunits += $movingunits[ 'u' . $i ] ?? 0; + $totalunits += $reinforcingunits[ 'u' . $i ] ?? 0; } - $totalunits += $movingunits['hero']; - $totalunits += $reinforcingunits['hero']; + $totalunits += $movingunits['hero'] ?? 0; + $totalunits += $reinforcingunits['hero'] ?? 0; return $totalunits; } diff --git a/Templates/Notice/1.tpl b/Templates/Notice/1.tpl index 4fef5def..ac944a2d 100644 --- a/Templates/Notice/1.tpl +++ b/Templates/Notice/1.tpl @@ -144,7 +144,9 @@ if ($hasHero) { } // PRISONERS (unchanged logic but safer sum) -if (!$spy && array_sum(array_slice($dataarray, 182, 11)) > 0) { +// Cast to int: some reports carry non-numeric text in these slots (e.g. the +// "Information" line shifts indices), which made array_sum() warn under PHP 8. +if (!$spy && array_sum(array_map('intval', array_slice($dataarray, 182, 11))) > 0) { echo "