Skip to content

Commit

Permalink
Protect usage of some array keys
Browse files Browse the repository at this point in the history
  • Loading branch information
xtophe38 committed Oct 20, 2023
1 parent d33e163 commit db34111
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion module.teemip-ip-discovery-collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
12 changes: 10 additions & 2 deletions src/TeemIpDiscoveryCollectionPlan.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down

0 comments on commit db34111

Please sign in to comment.