summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2025-12-03 11:38:51 +0100
committerSimon Rettberg2025-12-03 11:39:55 +0100
commitd4f9260723c0abdd1179aaad8b119fcad3045f36 (patch)
treed0085dfd4c10042e28446116c41595bc3f2608ed
parent[inc/IpUtil] Fix bug in CIDR verification (diff)
downloadslx-admin-d4f9260723c0abdd1179aaad8b119fcad3045f36.tar.gz
slx-admin-d4f9260723c0abdd1179aaad8b119fcad3045f36.tar.xz
slx-admin-d4f9260723c0abdd1179aaad8b119fcad3045f36.zip
[locations] Fix falsy checks
Thanks Junie AI
-rw-r--r--modules-available/locations/inc/locationutil.inc.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules-available/locations/inc/locationutil.inc.php b/modules-available/locations/inc/locationutil.inc.php
index 6114b0fb..9039de74 100644
--- a/modules-available/locations/inc/locationutil.inc.php
+++ b/modules-available/locations/inc/locationutil.inc.php
@@ -14,21 +14,21 @@ class LocationUtil
}
$locs = Location::getLocationsAssoc();
$subnets = Location::getSubnets();
- if ($overlapSelf) {
+ if ($overlapSelf !== false) {
$self = array();
}
- if ($overlapOther) {
+ if ($overlapOther !== false) {
$other = array();
}
$cnt = count($subnets);
for ($i = 0; $i < $cnt; ++$i) {
for ($j = $i + 1; $j < $cnt; ++$j) {
- if ($overlapSelf && $subnets[$i]['locationid'] === $subnets[$j]['locationid']
+ if ($overlapSelf !== false && $subnets[$i]['locationid'] === $subnets[$j]['locationid']
&& self::overlap($subnets[$i], $subnets[$j])
) {
$self[$subnets[$i]['locationid']] = $subnets[$i]['locationid'];
}
- if ($overlapOther && $subnets[$i]['locationid'] !== $subnets[$j]['locationid']
+ if ($overlapOther !== false && $subnets[$i]['locationid'] !== $subnets[$j]['locationid']
&& self::overlap($subnets[$i], $subnets[$j])
) {
$a = min($subnets[$i]['locationid'], $subnets[$j]['locationid']);
@@ -37,7 +37,7 @@ class LocationUtil
}
}
}
- if ($overlapSelf) {
+ if ($overlapSelf !== false) {
$overlapSelf = array();
foreach ($self as $entry) {
if (!isset($locs[$entry]))
@@ -45,7 +45,7 @@ class LocationUtil
$overlapSelf[]['locationname'] = $locs[$entry]['locationname'];
}
}
- if ($overlapOther) {
+ if ($overlapOther !== false) {
$overlapOther = array();
foreach ($other as $entry) {
if (!isset($locs[$entry['lid1']]) && !isset($locs[$entry['lid2']]))