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

PHP Warning 'Undefined array key' error appears if passed non-existent dcheckid

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • 5.0.34, 6.0.17, 6.4.2rc2, 7.0.0alpha1
    • API (A)

      Steps to reproduce:

      • Create drule with dcheck e.g. :
        -) FTP port 21
      • Update drule FTP check via API request using dcheckid param with non-existent id:
      {
          "jsonrpc": "2.0",
          "method": "drule.update",
          "params": {
              "druleid": "3",        
               "dchecks": [
               	{
                       "dcheckid": "{NON_EXISTENT_ID}",
                  	 "type": "3",
                       "ports": "21"
                      }
              ]
          },
          "id": 1
      }
      
      • Check apache2 error.log

      Result: An error appears in apache2 error.log:

       [Tue Apr 25 13:36:59.256219 2023] [php:warn] PHP Warning:  Undefined array key 777 in /home/zabbix/workspace/master/ui/include/classes/db/DB.php on line 787
      

      and no validation error in API:

      Expected: No php warning should appear. The validation error should appear on API.

            zabbix.dev Zabbix Development Team
            kseve Kirils Seve
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: