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

Validation rule "array_db" generates default PHP errors when input value is not an array

    XMLWordPrintable

    Details

    • Team:
      Team B
    • Sprint:
      Sprint 57 (Oct 2019), Sprint 58 (Nov 2019)
    • Story Points:
      0.125

      Description

      Steps to reproduce:

      This can be reproduced everywhere where array_db rule is used, just passing non-array value. ** Here is an example with value mapping (assuming that ZBXNEXT-5486 is merged):

      1. Navigate to Administration -> General -> Value mapping
      2. Open single value map
      3. Using inspect element, select "delete" button and remove urlencoded "[]" part from it's redirect target (field "valuemapids" should become an integer).
      4. Press "delete" and let fatal error happen

      Result:

      Before nicely formatted errors there are following errors visible:

      Argument 1 passed to CNewValidator::is_array_db() must be of the type array, string given, called in /var/www/zabbix/frontends/php/include/classes/validators/CNewValidator.php on line 187 and defined [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerValuemapDelete->checkInput() → CController->validateInput() → CNewValidator->__construct() → CNewValidator->validate() → CNewValidator->validateField() → CNewValidator->is_array_db() in include/classes/validators/CNewValidator.php:386]
      Invalid argument supplied for foreach() [zabbix.php:21 → require_once() → ZBase->run() → ZBase->processRequest() → CController->run() → CControllerValuemapDelete->checkInput() → CController->validateInput() → CNewValidator->__construct() → CNewValidator->validate() → CNewValidator->validateField() → CNewValidator->is_array_db() in include/classes/validators/CNewValidator.php:389]

      Expected:
      There should be nicely formatted errors only in fatal error screen.

        Attachments

          Activity

            People

            Assignee:
            Miks.Kronkalns Miks Kronkalns
            Reporter:
            Miks.Kronkalns Miks Kronkalns
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: