Page 1 of 1

Nagvis: Trying to access array offset on value of type int

Posted: Thu Nov 04, 2021 1:49 am
by AirBank_HD
Hi, I updated nagiosxi to 5.8.7 and php to 7.4. After the update I can't create a new map. Where could be the problem?
OS: CentOS 7
PHP: PHP 7.4.25
Nagiosxi: 5.8.7
Nagvis: 1.9.8

Code: Select all

Error: (0) Trying to access array offset on value of type int
URL: /nagvis/server/core/ajax_handler.php?mod=Map&act=getMapObjects&show=ITSECURITY&header_menu=1&hover_menu=1&context_menu=1&zoom=100&_ajaxid=1636008386
File: /usr/local/nagvis/share/server/core/classes/GlobalMapCfg.php
Line: 970
#0 /usr/local/nagvis/share/server/core/classes/GlobalMapCfg.php(970): nagvisExceptionErrorHandler()
#1 /usr/local/nagvis/share/server/core/classes/GlobalMapCfg.php(489): GlobalMapCfg->verifyObjectIds()
#2 /usr/local/nagvis/share/server/core/classes/CoreModMap.php(319): GlobalMapCfg->readMapConfig()
#3 /usr/local/nagvis/share/server/core/classes/CoreModMap.php(105): CoreModMap->getMapObjects()
#4 /usr/local/nagvis/share/server/core/functions/index.php(120): CoreModMap->handleAction()
#5 /usr/local/nagvis/share/server/core/ajax_handler.php(59): require('/usr/local/nagv...')
#6 {main}

Re: Nagvis: Trying to access array offset on value of type i

Posted: Thu Nov 04, 2021 1:13 pm
by benjaminsmith
HI,

Welcome to the Nagios Customer Support Forum!

It looks like you are hitting the issue below after the upgrade.

Fix: php7.4 Trying to access array offset on value of type int

Please try making the proposed change to the GlobalMapCfg.php in the following directory.

Code: Select all

/usr/local/nagvis/share/server/core/classes/GlobalMapCfg.ph
And let us know if that resolves the issue. If not, please send us the system profile. Thanks, Benjamin

To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button

Re: Nagvis: Trying to access array offset on value of type i

Posted: Fri Nov 05, 2021 4:44 am
by AirBank_HD
Thanks! I changed the GlobalMapCfg.php lines

Code: Select all

if($id[0] == '_')
     $todo = true;
to

Code: Select all

if($id !== 0 && isset($id[0]) && $id[0] == '_') {
            $todo = true;
        }
Nagvis started working.

Re: Nagvis: Trying to access array offset on value of type i

Posted: Fri Nov 05, 2021 3:03 pm
by benjaminsmith
Hi,

Great, glad that's working for you now.

We'll go ahead and close this out, but feel free to reach out again if you need help with anything else.

Have a great weekend!