[ZBX-9975] Undefined index in template import Created: 2015 Oct 20  Updated: 2017 May 30  Resolved: 2015 Oct 29

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Frontend (F)
Affects Version/s: 3.0.0alpha4
Fix Version/s: 3.0.0alpha4

Type: Incident report Priority: Blocker
Reporter: Oleg Egorov (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: import, triggerprototypes, undefinedindex
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: XML File zbx_export_templates.xml    

 Description   
Undefined index: expression [conf.import.php:200 ? CFrontendApiWrapper->import() ? CApiWrapper->__call() ? CFrontendApiWrapper->callMethod() ? CApiWrapper->callMethod() ? CFrontendApiWrapper->callClientMethod() ? CLocalApiClient->callMethod() ? call_user_func_array() ? CConfiguration->import() ? CConfigurationImport->import() ? CConfigurationImport->processDiscoveryRules() ? CTriggerPrototype->update() ? CTriggerPrototype->updateReal() in include\classes\api\services\CTriggerPrototype.php:777]

See zbx_export_templates.xml

Export file generated from 2.0.15rc1



 Comments   
Comment by Gunars Pujats (Inactive) [ 2015 Oct 26 ]

(1) No translation strings changed.

iivs CLOSED.

Comment by Gunars Pujats (Inactive) [ 2015 Oct 26 ]

RESOLVED in development branch svn://svn.zabbix.com/branches/dev/ZBX-9975

Comment by Ivo Kurzemnieks [ 2015 Oct 27 ]

(2) Maybe it's not so good to set expression as empty string always and then unset it anyway. I propose to write it like this:

if ($expressionChanged) {
	$triggerPrototypeUpdate['expression'] = $expression;
}
else {
	unset($triggerPrototypeUpdate['expression']);
}

And as discussed the unset() function for PHP5 will not issue a warning if expression array index does not exist.
I corrected the code in r56392, please review.

gunarspujats CLOSED

Comment by Ivo Kurzemnieks [ 2015 Oct 27 ]

TESTED,

but close (2) before merging.

Comment by Gunars Pujats (Inactive) [ 2015 Oct 28 ]

Fixed in:

  • pre-3.0.0alpha4 (trunk) r56400
Comment by Gunars Pujats (Inactive) [ 2015 Oct 28 ]

(3) API documentation:

iivs I don't think this should be there. The undefined index did not appear in 2.4, therefore this is not change from 2.4 to 3.0. The undefined index was introduced during the fix in 2.5.1 r55475

REOPENED

gunarspujats Documentation entry removed.

iivs Thanks!
CLOSED

Generated at Thu Apr 25 05:20:26 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.