PHP 8.4 Syntax Issue - gauges.inc.php
Posted: Mon Oct 06, 2025 8:58 am
Hello,
As of a recent update of Nagios XI to v2024.2.2.1 then a PHP 8.4 upgrade in the Nagios XI host, any service performance graphs would sit and never render. They get a constant spinning wheel.
I fixed the issue but it then returned in Nagios XI 2026R1.
The PHP error logs revealed the following:
Doing a little digging it turned out to be a syntax correction in the script to get the performance graphs on services to render again.
TO
This is likely a PHP 8.4 change/update to former syntax.
After making this change in the code, restarting PHP and nagios it was back to normal.
Can this be added to the next round of updates?
As of a recent update of Nagios XI to v2024.2.2.1 then a PHP 8.4 upgrade in the Nagios XI host, any service performance graphs would sit and never render. They get a constant spinning wheel.
I fixed the issue but it then returned in Nagios XI 2026R1.
The PHP error logs revealed the following:
Code: Select all
Uncaught ValueError: str_getcsv(): Argument #3 ($enclosure) must be a single character in /usr/local/nagiosxi/html/includes/dashlets/gauges/gauges.inc.php:351Code: Select all
Changed the ' to a single quote ' and the perf graphs were then able to load.
$perfdata_datasources = str_getcsv($status['performance_data'], " ", "'");
foreach ($perfdata_datasources as $perfdata_datasource) {
$perfdata_s = explode('=', $perfdata_datasource);
$perfdata_name = trim(str_replace("'", "", $perfdata_s[0]));
Code: Select all
$perfdata_datasources = str_getcsv($status['performance_data'], " ", "'");
foreach ($perfdata_datasources as $perfdata_datasource) {
$perfdata_s = explode('=', $perfdata_datasource);
$perfdata_name = trim(str_replace("'", "", $perfdata_s[0]));
After making this change in the code, restarting PHP and nagios it was back to normal.
Can this be added to the next round of updates?