[ZBX-7492] Undefined index if import XML is without macros. Created: 2013 Dec 05  Updated: 2017 May 30  Resolved: 2017 Apr 11

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: None
Fix Version/s: 2.2.11rc1, 2.2.18rc1, 2.4.7rc1

Type: Incident report Priority: Blocker
Reporter: Eduards Samersovs (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: undefinedindex, xml
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File undefined_index.png     XML File zbx_export_hosts.xml    
Issue Links:
Duplicate
is duplicated by ZBX-9422 Importing XML without macros section ... Closed
Team: Team A
Sprint: Sprint 5

 Description   
Undefined index: macros [conf.import.php:130 ? CConfigurationImport->import() ? CConfigurationImport->gatherReferences() in /home/zabbix/www/trunk/frontends/php/include/classes/import/CConfigurationImport.php:229]
Invalid argument supplied for foreach() [conf.import.php:130 ? CConfigurationImport->import() ? CConfigurationImport->gatherReferences() in /home/zabbix/www/trunk/frontends/php/include/classes/import/CConfigurationImport.php:229]

Same for inventory:

Undefined index: inventory [conf.import.php:130 ? CConfigurationImport->import() ? CConfigurationImport->processHosts() ? CHostImporter->import() ? CAPIObject->update() ? CAPIObject->__call() ? czbxrpc::call() ? czbxrpc::callAPI() ? call_user_func() ? CHost->update() in /home/zabbix/www/trunk/frontends/php/api/classes/CHost.php:947]


 Comments   
Comment by richlv [ 2013 Dec 05 ]

for the record, there are probably hundreds of ways to get undefined indexes when importing xml. last discussion i remember was "too messy to fix properly, have to wait for correct xml validation"

Comment by richlv [ 2014 Sep 01 ]

also, isn't this yet another case of missing xml validation, like ZBXNEXT-272 ?

Comment by Kodai Terashima [ 2015 Mar 23 ]

(1) I think it's better to delete macros while importing XML without macros section like inventory not only fixing undefined index.

sasha behavior should be:

  • In case of an empty tag "macros": Macros must be removed from the host
  • In case absence of the tag "macros": Macros should remain unchanged

This behavior is already implemented in pre-2.5.0 (trunk). In earlier versions of the behavior remains without changes, i.e. macros will be deleted in this cases.

sasha CLOSED

Comment by Gunars Pujats (Inactive) [ 2015 Aug 07 ]

(2) No translation strings changed.

sasha CLOSED

Comment by Gunars Pujats (Inactive) [ 2015 Aug 07 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-7492

Comment by Alexander Vladishev [ 2015 Aug 12 ]

(3) the new code is incorrectly formatted

gunarspujats RESOLVED in r54886

sasha CLOSED

Comment by Alexander Vladishev [ 2015 Aug 13 ]

Successfully tested!

Comment by Alexander Vladishev [ 2015 Aug 13 ]

Fixed in:

  • pre-2.2.11 r54900
  • pre-2.4.7 r54901
Comment by Oleg Ivanivskyi [ 2016 Jan 04 ]

This issue is still actual in Zabbix 2.4.7.

Comment by Oleg Ivanivskyi [ 2016 Jan 04 ]

How to reproduce:

  1. download template (https://share.zabbix.com/network_devices/netscaler)
  2. try to import
Comment by Pavel [ 2017 Apr 01 ]

I confirm the presence of the bug:

"How to reproduce:
download template (https://share.zabbix.com/network_devices/netscaler)
try to import"

Comment by Alexander Vladishev [ 2017 Apr 01 ]

Gaf89, please clarify Zabbix version.

Comment by Alexander Vladishev [ 2017 Apr 01 ]

I can reproduce it only on 2.2.18. Zabbix 3.0 and 3.2 works fine without errors.

Undefined index: macros [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->gatherReferences() in include/classes/import/CConfigurationImport.php:211]
Invalid argument supplied for foreach() [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->gatherReferences() in include/classes/import/CConfigurationImport.php:211]
Comment by Miks Kronkalns [ 2017 Apr 04 ]

I can reproduce it on 2.2 and 2.4.

sasha Zabbix 2.4 is not more supported. It should be fixed in 2.2 only.

Comment by Miks Kronkalns [ 2017 Apr 04 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-7492

Comment by Alexander Vladishev [ 2017 Apr 04 ]

(1) No translation strings changed

Miks.Kronkalns CLOSED

Comment by Alexander Vladishev [ 2017 Apr 04 ]

(2) [A] Another error when importing a template without <macros> tag.

Invalid argument supplied for foreach() [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processTemplates() → CTemplateImporter->import() → CTemplateImporter->resolveTemplateReferences() ininclude/classes/import/importers/CTemplateImporter.php:223]

Miks.Kronkalns RESOLVED in r67061

sasha CLOSED

Comment by Miks Kronkalns [ 2017 Apr 11 ]

Fixed:
pre-2.2.18rc1 r67206

Generated at Fri Mar 29 08:34:56 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.