Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-3968

PHP error "Uncaught TypeError: in_array()" on SLA page

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • None
    • Enterprise Edition
    • Default
    • PHP8.0

    Description

      The SLA page (/slas) only displayed menu bar.

      In the PHP log, we can see this error :

      PHP Fatal error:  Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /opt/observium/21.12.11808/html/pages/slas.inc.php:146\nStack trace:\n#0 /opt/observium/21.12.11808/html/pages/slas.inc.php(146): in_array()\n#1 /opt/observium/21.12.11808/html/index.php(271): include('...')\n#2 {main}\n  thrown in /opt/observium/21.12.11808/html/pages/slas.inc.php on line 146'

       

      I thiking it's related to PHP 8.0.

      I solved the problem with this code modification line 146:

       

      -   if ($owner == $vars['owner'] || in_array($owner, $vars['owner']) )
      if ($owner == $vars['owner'] || (!safe_empty($vars['owner']) && in_array($owner, $vars['owner'])) )

       

       

      I don't know if this is the official method for Observium, but it works

       

      Attachments

        Activity

          [OBS-3968] PHP error "Uncaught TypeError: in_array()" on SLA page

          Fixed in r11819.

          landy Mike Stupalov added a comment - Fixed in r11819.

          Ugh. I miss click . It's Profesionnal Version.

          Not possible edit the original message. Sorry!

          johann Johann Mallet added a comment - Ugh. I miss click . It's Profesionnal Version. Not possible edit the original message. Sorry!

          General questions and device support can be discussed in our Discord channel, click here to join.


          Please make and attach additional information about the device:

          • full snmp dump from device:

            snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -ObentxU <hostname> .1 > myagent.snmpwalk
            snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -ObentxU <hostname> .1.3.6.1.4.1 >> myagent.snmpwalk

            If device not support SNMP version 2c, replace -v2c with -v1.

          • If you have problems with discovery or poller processes, please do and attach these debugs:

            ./discovery.php -d -h <device>
            ./poller.php -d -h <device>

          • additionally attach device and/or vendor specific MIB files

          This comment is added automatically.

          bot Observium Bot added a comment - General questions and device support can be discussed in our Discord channel, click here to join . Please make and attach additional information about the device: full snmp dump from device: snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -ObentxU <hostname> .1 > myagent.snmpwalk snmpwalk -v2c -c <community> -t 3 -Cc --hexOutputLength=0 -ObentxU <hostname> .1.3.6.1.4.1 >> myagent.snmpwalk If device not support SNMP version 2c, replace -v2c with -v1. If you have problems with discovery or poller processes, please do and attach these debugs: ./discovery.php -d -h <device> ./poller.php -d -h <device> additionally attach device and/or vendor specific MIB files This comment is added automatically.

          People

            landy Mike Stupalov
            johann Johann Mallet
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: