Page 1 of 1

PHP 8.4 Syntax Issue - gauges.inc.php

Posted: Mon Oct 06, 2025 8:58 am
by Alongaks
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:

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:351
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.

Code: 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]));
TO

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]));
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?

Re: PHP 8.4 Syntax Issue - gauges.inc.php

Posted: Mon Oct 06, 2025 3:51 pm
by lgute
Hi @Alongaks,

Thanks for reaching out. An issue in our bug tracking system. While I cannot guarantee it will make it in the next release, when it does it will appear in the CHANGELOG as [GL:XI#2176].

Re: PHP 8.4 Syntax Issue - gauges.inc.php

Posted: Wed Oct 29, 2025 5:07 pm
by DoubleDoubleA
Hi @Alongaks,

How well does the rest of the application work for you in php8.4? In testing this change internally we're seeing other issues on 8.4. What distro are you on? Did you update to 8.4 before or after XI was installed?

Thanks!

Aaron
Product Development Manager

Re: PHP 8.4 Syntax Issue - gauges.inc.php

Posted: Wed Oct 29, 2025 8:34 pm
by ariellrut
Your diagnosis is spot-on. PHP 8.4 introduced stricter validation for functions like

Code: Select all

str_getcsv()
, particularly requiring the

Code: Select all

$enclosure
parameter to be a single character. Previously, using something like

Code: Select all

'
(which is an HTML entity) might have been tolerated or ignored, but PHP 8.4 enforces this rule strictly.

Your fix—replacing ' with ' in the $enclosure argument—aligns with PHP's requirements and restores proper functionality. It’s a good catch that this change is necessary for compatibility with PHP 8.4.

Re: PHP 8.4 Syntax Issue - gauges.inc.php

Posted: Thu Oct 30, 2025 5:59 am
by Krist
Since lgute confirmed this is tracked as [GL:XI#2176], is there any update on whether the official fix will make it into the next maintenance release of Nagios XI, or will it be held until the stability issues on PHP 8.4 are fully resolved?
null’s brawl

Re: PHP 8.4 Syntax Issue - gauges.inc.php

Posted: Thu Oct 30, 2025 9:14 am
by DoubleDoubleA
Hi @Krist,

In QA-ing that specific fix, we updated a couple of test machines to 8.4 as part of the QA process, and in that found some other parts of the interface that likely need attention for the 8.4 update. Which was why I jumped into the conversation yesterday, asking about distros and other experience with 8.4. So while we could release that fix, we're likely not out of the woods yet on the full scope of work required to support php 8.4.

Aaron

Re: PHP 8.4 Syntax Issue - gauges.inc.php

Posted: Mon Dec 15, 2025 8:32 am
by wardenr
Krist wrote: Thu Oct 30, 2025 5:59 am Since lgute confirmed this is tracked as [GL:XI#2176], is there any update on whether the official fix will make it into the next maintenance release of Nagios XI, or will it be held until the stability issues on PHP 8.4 are fully resolved?
COC MOD APK
It fixes an issue with the Smart… (changelog entry truncated in the source), and it appears alongside other PHP-related fixes such as GL:XI#2168, which specifically addresses gauges not rendering with PHP 8.4.

Re: PHP 8.4 Syntax Issue - gauges.inc.php

Posted: Mon Dec 15, 2025 10:00 am
by lgute
Hi @Krist,

The fix for [GL:XI#2176] was released in XI 2026R1.01. Additional fixes will be released in 2026R1.1 and we will continue to work on supporting PHP 8.4.