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

Value mapping does not check if given value is numeric

XMLWordPrintable

    • Sprint 98 (Mar 2023), Sprint 99 (Apr 2023)
    • 0.25

      1. Create several value mappings:

      type value mapped to
      equals 1K A
      equals 2X B
      equals Y3Y C

      2. Create numeric item (integer or float)
      3. Send some values to item and observe the results:

      item value result expected
      0 C (0) 0
      1 A (1) 1
      2 B (2) 2
      3 3 3

      Possible solution to change this code in CValueMapHelper.php::matchMapping():

      (floatval($value) == floatval($mapping['value']))
      

      to check if the mapping is actually numeric:

      (is_numeric($mapping['value']) && floatval($value) == floatval($mapping['value']))
      

            esekace Eliza Sekace
            iivs Ivo Kurzemnieks
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: