Page 1 of 1

Warning: Trying to access array offset on value of type bool

Posted: Sat Feb 19, 2022 6:22 am
by Helmut
Hi,

I just upgraded FreeBSD 12.3 from php74 to php80. When I access Nagios 4.4.6 I get

Warning: Trying to access array offset on value of type bool in /var/www/nagios/includes/utils.inc.php on line 217

Code: Select all

if($s[0]=='#')
   continue;
I checked the output of $s with

Code: Select all

echo "Value " . $s . "<BR>";
The result:
  • Value main_config_file=/usr/local/etc/nagios/nagios.cfg
    Value #physical_html_path=/usr/local/www/nagios
    Value physical_html_path=/var/www/nagios
    Value #url_html_path=/nagios
    Value url_html_path=/
    Value show_context_help=0
    Value #nagios_check_command=/usr/local/libexec/nagios/check_nagios /var/spool/nagios/status.dat 5 '/usr/local/bin/nagios'
    Value use_authentication=1
    Value #default_user_name=guest
    Value #authorized_for_system_information=nagiosadmin,theboss,jdoe
    Value #authorized_for_configuration_information=nagiosadmin,jdoe
    Value #authorized_for_system_commands=nagiosadmin
    Value #authorized_for_all_services=nagiosadmin,guest
    Value #authorized_for_all_hosts=nagiosadmin,guest
    Value #authorized_for_all_service_commands=nagiosadmin
    Value #authorized_for_all_host_commands=nagiosadmin
    Value #statusmap_background_image=smbackground.gd2
    Value default_statusmap_layout=5
    Value default_statuswrl_layout=4
    Value #statuswrl_include=myworld.wrl
    Value ping_syntax=/bin/ping -n -U -c 5 $HOSTADDRESS$
    Value refresh_rate=90
    Value result_limit=250
    Value #host_unreachable_sound=hostdown.wav
    Value #host_down_sound=hostdown.wav
    Value #service_critical_sound=critical.wav
    Value #service_warning_sound=warning.wav
    Value #service_unknown_sound=warning.wav
    Value #normal_sound=noproblem.wav
    Value default_user_name=guest
    Value authorized_for_system_information=helmut
    Value authorized_for_configuration_information=helmut
    Value authorized_for_system_commands=helmut
    Value authorized_for_all_service_commands=helmut
    Value authorized_for_all_host_commands=helmut
    Value authorized_for_all_services=*
    Value authorized_for_all_hosts=*
    Value
Notice the empty "Value" at the end.

While this can be fixed by

Code: Select all

if($s) {
  if($s[0]=='#')
    continue;
}
I'm wondering if this is related to PHP8 or anything else. Apart from that Nagios works fine.

Thank you!

Re: Warning: Trying to access array offset on value of type

Posted: Thu Mar 17, 2022 12:38 am
by ClaudeSj456
I am getting a similar message with a different plugin, not in the admin panel but on almost every page of my actual website, unfortunately.

Notice: Trying to access array offset on value of type bool in /var/www/html/lib_sites/or/main/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php on line 499

Here is the line of code in api-template.php:
$name = $field[‘name’];

The plugin developer said he would look into it, but meanwhile, I would welcome any suggestions.