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

Undefined offset when creating host prototype on host and template via API

XMLWordPrintable

    • Sprint 77 (Jun 2021), Sprint 78 (Jul 2021)
    • 0.5

      Steps to reproduce:

      1. Create template AAA
      2. Create discovery rule on this template
      3. Create host BBB
      4. Create discovery rule on this host
      5. Link template AAA to host
      6. Send api request to create two host prototypes, one on host and one on template
            "method": "hostprototype.create",
            "params": [
                {
                    "host": "{#HOST} prototype",
                    "ruleid": "33768",
                    "groupLinks": [
                        {
                            "groupid": "5"
                        }
                    ]
                },
                {
                    "host": "{#TEMPLATE} prototype",
                    "ruleid": "35801",
                    "groupLinks": [
                        {
                            "groupid": "5"
                        }
                    ]
                }
            ],
        

      Result:
      PHP runtime error

      Undefined offset: 33768 [api_jsonrpc.php:63 -> CJsonRpc->execute() -> CLocalApiClient->callMethod() -> CHostPrototype->create() -> CHostPrototype->inherit() -> CHostPrototype->prepareInheritedObjects() -> CConfigFile->{closure}() in include/classes/api/services/CHostPrototype.php:790]
      Trying to access array offset on value of type null [api_jsonrpc.php:63 -> CJsonRpc->execute() -> CLocalApiClient->callMethod() -> CHostPrototype->create() -> CHostPrototype->inherit() -> CHostPrototype->prepareInheritedObjects() -> CConfigFile->{closure}() in include/classes/api/services/CHostPrototype.php:790]
      

      Expected:
      no errors

            Miks.Kronkalns Miks Kronkalns
            natalja.zabbix Natalja Romancaka
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: