[ZBX-6840] "Undefined index" and "Invalid argument supplied" in maps.inc.php Created: 2013 Jul 31  Updated: 2017 May 30  Resolved: 2014 May 02

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.7
Fix Version/s: 2.0.9rc1

Type: Incident report Priority: Blocker
Reporter: Alexander Vladishev Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: maps, regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBX-6886 "System status" widget in Dashboard d... Closed

 Description   

Undefined index: 10086 [include/maps.inc.php:1145]
Invalid argument supplied for foreach() [include/maps.inc.php:1145]

The similar problem was fixed in pre-2.1.0 r32718 under ZBX-6096.

How to reproduce:

  • create 2 hosts with a trigger that uses items from these hosts
  • create a map with a host (only one host should be on the map)
  • go to Monitoring -> Maps

regression, broken by:

r36359 | tomtom | 2013-06-14 11:46:30 +0300 (Fri, 14 Jun 2013) | 10 lines
Changed paths:
M /branches/2.0
M /branches/2.0/ChangeLog
M /branches/2.0/frontends/php/api/classes/CTrigger.php
M /branches/2.0/frontends/php/include/db.inc.php

A......... ZBX-6603
fixed performance for dbConditionInt() function:
changed array iteration to foreach loop so array would not be copied;
replaced array_merge() function by more appropriate functionality, which lead to a performance boost from 25s to 17s on one my setup.

added sorting for groups so it would work correctly with dbConditionInt(), which I think gave some performance boost as well;
removed group, host and item adding within data formatting, which doesn't work as intended with optimized customFetch() method, now groups, items and hosts are added same way as setting selectHosts, for example;
previous fixed problem that if trigger belongs to several groups, it is shown only in one in system_status widget;
wrote custom SQL to retrieve all lastEvents in single query, this should be extended to support 'output' parameter, now all fields are returned;
left debug messages to, so optimizing could be improved on some other slower parts.



 Comments   
Comment by Alexey Pustovalov [ 2013 Aug 02 ]

The same problem on dashboard page when it has defined filter with selected a part of groups:

    Undefined index: 195 [include/blocks.inc.php:291]
    Undefined index: tab_priority [include/blocks.inc.php:291]
    Undefined index: 3 [include/blocks.inc.php:291]
    Undefined index: count [include/blocks.inc.php:291]

I think the problem should be solved for all places in the issue.

Comment by Ivo Kurzemnieks [ 2013 Aug 02 ]

Added index checking for triggers. Aslo added few extra index checks in unsafe places. Maybe some are not required now, maybe some will be required in future and/or some are overlooked.

RESOLVED for 2.0 in svn://svn.zabbix.com/branches/dev/ZBX-6840

Comment by rrr [ 2013 Aug 06 ]

Error still exists on Dashboard in zabbix-2.0.8rc1-37582:

Undefined offset: 9 [include/blocks.inc.php:291]
Undefined index: tab_priority [include/blocks.inc.php:291]
Undefined offset: 1 [include/blocks.inc.php:291]
Undefined index: count [include/blocks.inc.php:291]
Undefined index: count_unack [include/blocks.inc.php:300]
Undefined offset: 24 [include/blocks.inc.php:291]
Undefined index: tab_priority [include/blocks.inc.php:291]
Undefined offset: 1 [include/blocks.inc.php:291]
Undefined index: count [include/blocks.inc.php:291]
Undefined index: count_unack [include/blocks.inc.php:300]
Undefined offset: 4 [include/blocks.inc.php:291]
Undefined index: count [include/blocks.inc.php:291]
Undefined index: count_unack [include/blocks.inc.php:300]
Undefined offset: 11 [include/blocks.inc.php:291]
Undefined index: tab_priority [include/blocks.inc.php:291]
Undefined offset: 4 [include/blocks.inc.php:291]
Undefined index: count [include/blocks.inc.php:291]
Undefined index: count_unack [include/blocks.inc.php:300]
Undefined offset: 0 [include/blocks.inc.php:291]
Undefined index: count [include/blocks.inc.php:291]
Undefined index: count_unack [include/blocks.inc.php:300]
Undefined index: name [include/blocks.inc.php:317]
Undefined index: groupid [include/blocks.inc.php:317]
Undefined index: name [include/blocks.inc.php:317]
Undefined index: groupid [include/blocks.inc.php:317]
Undefined index: name [include/blocks.inc.php:317]
Undefined index: groupid [include/blocks.inc.php:317]
Comment by Ivo Kurzemnieks [ 2013 Aug 06 ]

Final changes in 2.0.8rc1 will be implementent when solution provided in development branch is tested and accepted.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Aug 06 ]

(1) The if clause in maps.inc.php lines 1054, 1109 and 1130 are not required because there the API will return only the data that is present on the map and no undefined indexes should occur.

iivs RESOLVED in r37623

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Aug 07 ]

TESTED.

Comment by Ivo Kurzemnieks [ 2013 Aug 07 ]

Fixed in pre-2.0.8rc1 r37642

Comment by richlv [ 2013 Aug 13 ]

(2) let's add tests for this (data in the test db that would trigger this problem). maybe it's worth adding this configuration with api calls, instead of direct sql inserts...

ESidorova At the moment it is more feasible to use sql inserts, that should be ok for now
ESidorova TESTED for trunk in svn://svn.zabbix.com/branches/dev/ZBX-6840-test

sasha CLOSED

Generated at Mon Jun 09 07:45:28 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.