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

graph.get API responds with database error if "graphids" is an array containing null

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 7.2.6
    • None
    • None

      When calling graph.get with the graphids filter set to an array containing only null ([null]), the api is responding with an database error.

      API request:

      {
          "jsonrpc": "2.0",
          "method": "graph.get",
          "params": {
            "output": "extend",
            "graphids": [null]
          },
          "id": 1
      } 

      API response:

      {
        "jsonrpc": "2.0",
        "error": {
          "code": -32500,
          "message": "Application error.",
          "data": "Database error occurred.",
          "debug": [
            {
              "file": "/usr/share/zabbix/include/classes/core/CJsonRpc.php",
              "line": 92,
              "function": "callMethod",
              "class": "CLocalApiClient",
              "type": "->"
            },
            {
              "file": "/usr/share/zabbix/api_jsonrpc.php",
              "line": 58,
              "function": "execute",
              "class": "CJsonRpc",
              "type": "->"
            }
          ]
        },
        "id": 1
      } 

      Errors in web server logs:

      zabbix-web-test-1  | [29-Apr-2025 13:22:41] WARNING: [pool zabbix] child 943 said into stderr: "[29-Apr-2025 15:22:41 Europe/Berlin] PHP Warning:  array_flip(): Can only flip string and integer values, entry skipped in /usr/share/zabbix/include/db.inc.php on line 496"
      zabbix-web-test-1  | [29-Apr-2025 13:22:41] WARNING: [pool zabbix] child 943 said into stderr: "[29-Apr-2025 15:22:41 Europe/Berlin] PHP Warning:  Error in query [SELECT g.* FROM graphs g WHERE  AND g.flags IN (0,4)] [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND g.flags IN (0,4)' at line 1] in /usr/share/zabbix/include/db.inc.php on line 200" 

            zabbix.dev Zabbix Development Team
            pwegrzyn Piotr Wegrzyn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: