Page 1 of 1
Error when trying to create new BPI
Posted: Wed Jan 15, 2025 3:39 am
by riahc3
When trying to Create New BPI Group, the page just shows blank and Im seeing this in the logs
Code: Select all
[Wed Jan 15 09:31:45.938985 2025] [php:warn] [pid 1506437] [client 1.2.3.4:8595] PHP Warning: Undefined variable $name in /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php on line 320, referer: https://srvnagios.domain.local/nagiosxi/includes/components/nagiosbpi/index.php
[Wed Jan 15 09:31:45.939062 2025] [php:error] [pid 1506437] [client 1.2.3.4:8595] PHP Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php:320\nStack trace:\n#0 /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php(320): array_map()\n#1 /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php(254): create_option_list()\n#2 /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/bpi_commands.php(75): build_form()\n#3 /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/bpi_page_router.php(107): handle_add_command()\n#4 /usr/local/nagiosxi/html/includes/components/nagiosbpi/index.php(179): bpi_page_router()\n#5 {main}\n thrown in /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php on line 320, referer: https://srvnagios.domain.local/nagiosxi/includes/components/nagiosbpi/index.php
What is wrong here? Nagios XI 2024R1.3.2 on Ubuntu 24.04.1
Re: Error when trying to create new BPI
Posted: Wed Jan 15, 2025 12:49 pm
by sgardil
riahc3 wrote: ↑Wed Jan 15, 2025 3:39 am
When trying to Create New BPI Group, the page just shows blank and Im seeing this in the logs
Code: Select all
[Wed Jan 15 09:31:45.938985 2025] [php:warn] [pid 1506437] [client 1.2.3.4:8595] PHP Warning: Undefined variable $name in /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php on line 320, referer: https://srvnagios.domain.local/nagiosxi/includes/components/nagiosbpi/index.php
[Wed Jan 15 09:31:45.939062 2025] [php:error] [pid 1506437] [client 1.2.3.4:8595] PHP Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php:320\nStack trace:\n#0 /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php(320): array_map()\n#1 /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php(254): create_option_list()\n#2 /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/bpi_commands.php(75): build_form()\n#3 /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/bpi_page_router.php(107): handle_add_command()\n#4 /usr/local/nagiosxi/html/includes/components/nagiosbpi/index.php(179): bpi_page_router()\n#5 {main}\n thrown in /usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php on line 320, referer: https://srvnagios.domain.local/nagiosxi/includes/components/nagiosbpi/index.php
What is wrong here? Nagios XI 2024R1.3.2 on Ubuntu 24.04.1
Looks like we are running into a php issue here. With newer version of PHP things have been deprecated and error handling has been handled differently since 8+ so it looks like we missed this error here when adding support for Ubuntu 24. I'll file an issue and look into a fix. If you are comfortable modifying lines of code I can give you the lines to change otherwise the fix will be in one of the upcoming releases. For the changelog line when it goes in will be tagged under the fixed section with [GL:XI#1441] in the changelog.
Re: Error when trying to create new BPI
Posted: Thu Jan 16, 2025 12:40 pm
by sgardil
If you're feeling adventurous and want to change the code for the fix yourself you can edit
Code: Select all
/usr/local/nagiosxi/html/includes/components/nagiosbpi/functions/build_form.inc.php
at line 315 you can replace
Code: Select all
foreach ($bpi_objects_array as $key => $row) {
$name[$key] = $row['name'];
$title[$key] = $row['title'];
}
array_multisort(array_map('strtolower', $name), SORT_ASC, array_map('strtolower', $title), SORT_ASC, $bpi_objects_array);
With
Code: Select all
if (is_array($bpi_objects_array) && !empty($bpi_objects_array)) {
foreach ($bpi_objects_array as $key => $row) {
$name[$key] = $row['name'];
$title[$key] = $row['title'];
}
array_multisort(array_map('strtolower', $name), SORT_ASC, array_map('strtolower', $title), SORT_ASC, $bpi_objects_array);
} else {
$bpi_objects_array = [];
}
Re: Error when trying to create new BPI
Posted: Mon Jan 27, 2025 5:15 am
by riahc3
A new version was released on Jan 22 and this fix is NOT included.
Why?
Re: Error when trying to create new BPI
Posted: Mon Jan 27, 2025 11:35 am
by sgardil
riahc3 wrote: ↑Mon Jan 27, 2025 5:15 am
A new version was released on Jan 22 and this fix is NOT included.
Why?
Well I can't go too in-depth with all the decisions made in our development process but I can give some insight. With development cycles at some point they reach a point where the version that we are going to push has to go into a QA cycle for testing. This is done so we can hopefully catch any bugs or weird interactions with changes that we have made. While we are in these QA cycles generally any new changes, with some exceptions, are put into the next version after what is currently in the QA cycle. That being said you can keep an eye on the changelog for this specific change with the issue number given above. It may not go in the next release either due to the QA cycles, but luckily the change is easy enough to make manually if you are willing to copy the code in yourself.
Re: Error when trying to create new BPI
Posted: Wed Feb 26, 2025 4:36 am
by willie34
Test the fix with one crew, using a simple tool like Excel or a BPM app, before going big
Love Pawsona