From c009c048f0ab79fd81f77ceb71436a914527276f Mon Sep 17 00:00:00 2001 From: Fredrik Soderblom Date: Wed, 16 Apr 2025 20:26:18 +0200 Subject: [PATCH 1/2] Fix undefined variable $out and complaints on undefined array keys - ssl_key et al if they are undefined. --- functions/classes/class.PDO.php | 7 +++++++ functions/classes/class.Scan.php | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/functions/classes/class.PDO.php b/functions/classes/class.PDO.php index aeb940c..1f076a2 100644 --- a/functions/classes/class.PDO.php +++ b/functions/classes/class.PDO.php @@ -1042,6 +1042,13 @@ private function set_db_params () { $this->ssl[PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT] = false; } + $db += [ + 'ssl_key' => null, + 'ssl_cert' => null, + 'ssl_ca' => null, + 'ssl_cipher' => null, + 'ssl_capath' => null + ]; foreach ($this->pdo_ssl_opts as $key => $pdoopt) { if ($db[$key]) { $this->ssl[$pdoopt] = $db[$key]; diff --git a/functions/classes/class.Scan.php b/functions/classes/class.Scan.php index e79a1b0..5cfba6d 100644 --- a/functions/classes/class.Scan.php +++ b/functions/classes/class.Scan.php @@ -446,6 +446,7 @@ public function ping_address_method_fping_subnet ($subnet_cidr, $return_result = exec($cmd, $output, $retval); # save result + $out = null; if(sizeof($output)>0) { foreach($output as $line) { if (!preg_match('/timed out/', $line)) { @@ -921,4 +922,4 @@ function fping_subnet ($subnet_cidr, $return = true) { global $Scan; //scan return $Scan->ping_address_method_fping_subnet ($subnet_cidr, $return); -} \ No newline at end of file +} From 831e49e84ce37199ac440c9709a3a9c8a9e1b582 Mon Sep 17 00:00:00 2001 From: Fredrik Soderblom Date: Thu, 17 Apr 2025 07:54:46 +0200 Subject: [PATCH 2/2] Fix undefined property stdClass::$discovered --- functions/classes/class.phpipamAgent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/classes/class.phpipamAgent.php b/functions/classes/class.phpipamAgent.php index aaf1f8d..8ed95c0 100644 --- a/functions/classes/class.phpipamAgent.php +++ b/functions/classes/class.phpipamAgent.php @@ -1025,7 +1025,7 @@ private function mysql_scan_discovered_write_to_db ($subnets) { } // loop foreach($subnets as $s) { - if(is_array($s->discovered)) { + if (isset($s->discovered) && is_array($s->discovered)) { foreach($s->discovered as $ip) { // try to resolve hostname $tmp = new stdClass();