Source: cacti
Severity: wishlist
Tags: patch

Dear Maintainer,

We are transitioning to php8.5 in Ubuntu and we found out that cacti
does not fully support php8.5. The attached patch adds support for
php8.5. Thanks for considering it.

-- 
Athos Ribeiro
Description: Support PHP 8.5
 - The backtick operator is now deprecated in favor of shell_exec.
 - Terminating case statements with a semicolon instead of a colon has been deprecated.
 - xml_parser_free was a noop since PHP 8.0 and is now deprecated.
Author: Athos Ribeiro [email protected]
Forwarded: https://github.com/Cacti/cacti/pull/6568
Last-Update: 2026-01-26
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lib/poller.php
+++ b/lib/poller.php
@@ -49,7 +49,7 @@
 
 		pclose($fp);
 	} else {
-		$output = `$command`;
+		$output = shell_exec($command);
 	}
 
 	return $output;
@@ -112,7 +112,7 @@
 
 			pclose($fp);
 		} else {
-			$output = `$command`;
+			$output = shell_exec($command);
 		}
 	}
 
--- a/lib/xml.php
+++ b/lib/xml.php
@@ -32,7 +32,9 @@
 	xml_parser_set_option($p, XML_OPTION_SKIP_WHITE, 1);
 	xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0);
 	xml_parse_into_struct($p, $data, $vals, $index);
-	xml_parser_free($p);
+	if (version_compare(PHP_VERSION, '8.0', '<')) {
+		xml_parser_free($p);
+	}
 
 	$tree = array();
 	$i = 0;
@@ -116,7 +118,9 @@
 	xml_parser_set_option($p, XML_OPTION_CASE_FOLDING, 0);
 	xml_parser_set_option($p, XML_OPTION_TARGET_ENCODING, 'UTF-8');
 	xml_parse_into_struct($p, $data, $vals, $index);
-	xml_parser_free($p);
+	if (version_compare(PHP_VERSION, '8.0', '<')) {
+		xml_parser_free($p);
+	}
 
 	$tree = array();
 	$i = 0;
--- a/include/vendor/phpsnmp/mib_parser.php
+++ b/include/vendor/phpsnmp/mib_parser.php
@@ -166,7 +166,7 @@
 						}
 
 						break;
-					case '"';
+					case '"':
 						$in_quote = true;
 
 						break;

Reply via email to