Error when the problems exceed 1000 -> 1k ([A non well formed numeric value encountered] + [ICINGAWEB2] + [PHP])

Describe the bug

In my ICINGA environment, in ICINGAWEB2 the rendering of the webpage is facing an error:

icingaweb2[5337]: Could not invoke custom navigation item renderer. ErrorException in /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Web/Navigation/Renderer/TotalProblemsBadge.php:55 with message: A non well formed numeric value encountered

This problem is observed when my ICINGAWEB2 Problems exceed 1000 it gets converted to 1K. This conversion takes place in a function in file “ProblemsBadge.php”.
File location on my system: /usr/share/icingaweb2/modules/icingadb/library/Icingadb/Web/Navigation/Renderer/ProblemsBadge.php

protected function round($count)
    {
        if ($count > 1000000) {
            $count = round($count, -6) / 1000000 . 'M';
        } elseif ($count > 1000) {
            $count = round($count, -3) / 1000 . 'k';
        }

        return $count;
    }

But other functions do not handle Non-Numeric Values, when round($count) is called.

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.

  1. Please set up the Icingaweb2 using apache2
  2. Make sure that Host or Service Problems in your Icingaweb2 exceed 1000 values
  3. Then check the status of apache2 on the server, it will give this error.

Expected behavior

The web interface should load properly, and this particular error stops the renderer and icingaweb2 is not working.

Screenshots



Your Environment

Include as many relevant details about the environment you experienced the problem in

  • Icinga Web 2 version and modules (System - About): 2.12.1
  • Web browser used: Google Chrome
  • Icinga 2 version used (icinga2 --version): The Icinga 2 network monitoring daemon (version: r2.14.0-1)
  • PHP version used (php --version): PHP 7.4.33, Zend Engine v3.4.0
  • Server operating system and version: SLES VERSION=“15-SP5”

https://github.com/Icinga/icingadb-web/issues/948