From db34111e745fd5d37e0b9d7935fcfd5911c86d29 Mon Sep 17 00:00:00 2001 From: xtophe38 Date: Fri, 20 Oct 2023 17:47:04 +0200 Subject: [PATCH] Protect usage of some array keys --- module.teemip-ip-discovery-collector.php | 2 +- src/TeemIpDiscoveryCollectionPlan.class.inc.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/module.teemip-ip-discovery-collector.php b/module.teemip-ip-discovery-collector.php index 8ea3889..2b01f2b 100644 --- a/module.teemip-ip-discovery-collector.php +++ b/module.teemip-ip-discovery-collector.php @@ -6,7 +6,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'teemip-ip-discovery-collector/3.1.1', + 'teemip-ip-discovery-collector/3.1.2', array( // Identification // diff --git a/src/TeemIpDiscoveryCollectionPlan.class.inc.php b/src/TeemIpDiscoveryCollectionPlan.class.inc.php index 07e4656..fc12e9d 100644 --- a/src/TeemIpDiscoveryCollectionPlan.class.inc.php +++ b/src/TeemIpDiscoveryCollectionPlan.class.inc.php @@ -390,10 +390,18 @@ public function GetApplicationParam($sParam) return $this->aDiscoveryApplication['UUID']; case 'last_discovery_date': - return $this->aDiscoveryApplication['last_discovery_date']; + if (array_key_exists('last_discovery_date', $this->aDiscoveryApplication)) { + return $this->aDiscoveryApplication['last_discovery_date']; + } else { + return null; + } case 'duration': - return $this->aDiscoveryApplication['duration']; + if (array_key_exists('duration', $this->aDiscoveryApplication)) { + return $this->aDiscoveryApplication['duration']; + } else { + return 0; + } case 'params': return $this->aDiscoveryApplication['params'];