Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-24683

problem.view PHP Fatal error: Uncaught TypeError: count()

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Fixed
    • Icon: Critical Critical
    • 7.0.2rc2, 7.2.0alpha1
    • 7.0.0
    • API (A)
    • None
    • Ubuntu 22
      PHP 8.1.2
      postgresql 16.3
      Apache 2.4.52
    • S24-W30/31
    • 0.25

      Steps to reproduce:

      1. Open Zabbix Web UI
      2. Expand Monitoring
      3. Click on Problems (without any filters applied)

      Result:
      [php:error] [pid 562821] [client *.*.*.*:26666] PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /usr/share/zabbix/include/classes/screens/CScreenProblem.php:286\nStack trace:\n#0 /usr/share/zabbix/include/classes/screens/CScreenProblem.php(824): CScreenProblem::getData()\n#1 /usr/share/zabbix/app/partials/monitoring.problem.view.html.php(73): CScreenProblem->get()\n#2 /usr/share/zabbix/include/classes/mvc/CPartial.php(104): include('...')\n#3 /usr/share/zabbix/include/classes/html/CObject.php(81): CPartial->getOutput()\n#4 /usr/share/zabbix/include/classes/html/CObject.php(61): unpack_object()\n#5 /usr/share/zabbix/include/classes/html/CTag.php(90): CObject->addItem()\n#6 /usr/share/zabbix/include/classes/html/CObject.php(68): CTag->addItem()\n#7 /usr/share/zabbix/include/classes/html/CTag.php(90): CObject->addItem()\n#8 /usr/share/zabbix/include/classes/html/CObject.php(68): CTag->addItem()\n#9 /usr/share/zabbix/include/classes/html/CTag.php(90): CObject->addItem()\n#10 /usr/share/zabbix/include/classes/html/CTag.php(47): CTag->addItem()\n#11 /usr/share/zabbix/include/classes/html/CHtmlPage.php(131): CTag->__construct()\n#12 /usr/share/zabbix/include/classes/html/CHtmlPage.php(98): CHtmlPage->toString()\n#13 /usr/share/zabbix/app/views/monitoring.problem.view.php(77): CHtmlPage->show()\n#14 /usr/share/zabbix/include/classes/mvc/CView.php(128): include('...')\n#15 /usr/share/zabbix/include/classes/core/ZBase.php(721): CView->getOutput()\n#16 /usr/share/zabbix/include/classes/core/ZBase.php(645): ZBase->processResponseFinal()\n#17 /usr/share/zabbix/include/classes/core/ZBase.php(228): ZBase->processRequest()\n#18 /usr/share/zabbix/include/config.inc.php(20): ZBase->run()\n#19 /usr/share/zabbix/zabbix.php(17): require_once('...')\n#20 {main}\n  thrown in /usr/share/zabbix/include/classes/screens/CScreenProblem.php on line 286
      [Tue Jun 18 06:57:06.467750 2024] [php:warn] [pid 562821] [client *.*.*.*:26666] PHP Warning:  Undefined array key "file" in /usr/share/zabbix/include/classes/debug/CProfiler.php on line 376
      [Tue Jun 18 06:57:06.467771 2024] [php:warn] [pid 562821] [client *.*.*.*:26666] PHP Warning:  Undefined array key "line" in /usr/share/zabbix/include/classes/debug/CProfiler.php on line 376
      [Tue Jun 18 06:57:06.467784 2024] [php:warn] [pid 562821] [client *.*.*.*:26666] PHP Warning:  Cannot modify header information - headers already sent in /usr/share/zabbix/include/classes/helpers/CCookieHelper.php on line 54
      [Tue Jun 18 06:57:06.467797 2024] [php:warn] [pid 562821] [client *.*.*.*:26666] PHP Warning:  Unknown: Failed to write session data using user defined save handler. (session.save_path: /var/lib/php/sessions) in Unknown on line 0
      Expected:
      The problem view to open up and display any problems that it might have retrieved.

      Observations:

      CScreenProblem.php
      $problems = ($filter['show'] == TRIGGERS_OPTION_ALL)
              ? self::getDataEvents($options)
              : self::getDataProblems($options);
      $end_of_data = (count($problems) < $limit + 1);
      $problems seems to be returning a boolean instead of an array when getDataProblems is called. 

        1. image-2024-07-24-21-04-46-578.png
          16 kB
          Alexey
        2. Scherm­afbeelding 2024-07-16 om 10.23.41-1.png
          127 kB
          Geoffrey Timmerman
        3. screenshot.png
          127 kB
          Oleksii Zagorskyi

            sasha Alexander Vladishev
            Damian99 Damian Vermeulen
            Team C
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 1h
                1h