Private GIT

Skip to content
Snippets Groups Projects
Commit 7392aa13 authored by Nathan Rennie-Waldock's avatar Nathan Rennie-Waldock
Browse files

Fix exception when deleting a section containing no subnets in PHP 8.0+

parent 958602f8
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,7 @@ if ($_POST['action']=="delete" && !isset($_POST['deleteconfirm'])) { ...@@ -64,7 +64,7 @@ if ($_POST['action']=="delete" && !isset($_POST['deleteconfirm'])) {
# no subsections # no subsections
else { else {
$subnets = $Subnets->fetch_section_subnets ($_POST['id']); //fetch all subnets in section $subnets = $Subnets->fetch_section_subnets ($_POST['id']); //fetch all subnets in section
$num_subnets = sizeof($subnets); $num_subnets = is_array($subnets) ? sizeof($subnets) : 0;
$ipcnt = $Addresses->count_addresses_in_multiple_subnets($subnets); $ipcnt = $Addresses->count_addresses_in_multiple_subnets($subnets);
} }
......
...@@ -169,7 +169,7 @@ class Sections extends Common_functions { ...@@ -169,7 +169,7 @@ class Sections extends Common_functions {
# truncate and delete all subnets in all sections, than delete sections # truncate and delete all subnets in all sections, than delete sections
foreach($all_ids as $id) { foreach($all_ids as $id) {
$section_subnets = $Subnets->fetch_section_subnets ($id); $section_subnets = $Subnets->fetch_section_subnets ($id);
if(sizeof($section_subnets)>0) { if(is_array($section_subnets) && sizeof($section_subnets)>0) {
foreach($section_subnets as $ss) { foreach($section_subnets as $ss) {
//delete subnet //delete subnet
$Subnets->modify_subnet("delete", array("id"=>$ss->id)); $Subnets->modify_subnet("delete", array("id"=>$ss->id));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment