[ZBX-5884] Errors in tr_testexp popup Created: 2012 Nov 22  Updated: 2017 May 30  Resolved: 2012 Dec 02

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.1.0
Fix Version/s: 1.8.16rc1, 2.0.5rc1, 2.1.0

Type: Incident report Priority: Trivial
Reporter: Oleg Egorov (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: triggertesting
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File bug.JPG    
Issue Links:
Duplicate
is duplicated by ZBX-5896 OR condition cannot be added correctl... Closed

 Description   

Expression:

(({H1:0000.last(0)}=0&{H1:asasa.last(0)}=0&{H1:xml.last(0)}=0)|({H1:0000.last(0)}=1&{H1:asasa.last(0)}=1&{H1:xml.last(0)}=1)|({H1:0000.last(0)}=2&{H1:asasa.last(0)}=2&{H1:xml.last(0)}=2))&(({H1:0000.last(0)}=5&{H1:asasa.last(0)}=5&{H1:xml.last(0)}=5)|({H1:0000.last(0)}=4&{H1:asasa.last(0)}=4&{H1:xml.last(0)}=4)|({H1:0000.last(0)}=3&{H1:asasa.last(0)}=3&{H1:xml.last(0)}=3)) | {TRIGGER.VALUE}=0

Expression constructor -> Test

We can enter any value, for example:

{H1:0000.last(0)} = 0
{H1:asasa.last(0)} = 0
{H1:xml.last(0)} = 0
{TRIGGER.VALUE} = 0

Result:

Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\2.1\frontends\php\include\triggers.inc.php(2419) : eval()'d code on line 1
Parse error: syntax error, unexpected ')' in C:\xampp\htdocs\2.1\frontends\php\include\triggers.inc.php(2419) : eval()'d code on line 1
...


 Comments   
Comment by Oleg Egorov (Inactive) [ 2012 Nov 27 ]

And incorrect trigger express test result

Comment by Alexander Vladishev [ 2012 Dec 02 ]

Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-5884

Comment by Toms (Inactive) [ 2012 Dec 03 ]

(1) Warning: Deprecated: Call-time pass-by-reference has been deprecated in C:\zabbix\ZBX-5884\frontends\php\include\triggers.inc.php on line 2017

everywhere in frontend

My PHP version: 5.3.13

sasha RESOLVED in r31832

tomtom CLOSED

Comment by Toms (Inactive) [ 2012 Dec 03 ]

(2) CTriggerGeneral.php

  • $length_old and $length_new should be in camelCase
  • duplicate code: ' {'.$exprPart['host'].':'.$exprPart['item'].'.'.$exprPart['function'].'}

    '

sasha RESLOVED in r31876
sasha reverse order in r31885
sasha more compact code in r31888

tomtom CLOSED

Comment by Toms (Inactive) [ 2012 Dec 03 ]

(3) triggers.inc.php line: 988 ... expressions could be iterated in reverse order, so there would be no need for $offset and $length_new variables

sasha RESOLVED in r31877 (fixed camelCase and duplicated code)
sasha reverse order in r31885
sasha more compact code in r31888

tomtom CLOSED

Comment by Toms (Inactive) [ 2012 Dec 03 ]

(4) getExpressionTree() function should not use referenced parameter but should return value instead.

sasha RESOLVED in r31878

tomtom CLOSED

Comment by Toms (Inactive) [ 2012 Dec 04 ]

(5) analyze_expression() should be in camelCase

as well:

  • $last_key in makeExpression() and buildExpressionHtmlTree()
  • remake_expression() function
  • $operand_found in getExpressionTree()

sasha RESOLVED in r31886, r31891

tomtom CLOSED

Comment by Toms (Inactive) [ 2012 Dec 04 ]

(6) buildExpressionHtmlTree() missing PHPDoc comment

sasha RESOLVED in r31887

tomtom CLOSED

Comment by Toms (Inactive) [ 2012 Dec 04 ]

(7) Following expression in expression constructor is treated as single expression:

((

{b2:agent.ping.last(0)}

=0&

{b:agent.ping.last(0)}

=0)&

{b:agent.ping.last(0)}

=0) + 1

sasha CLOSED it is impossible to expand the expression.

Comment by Toms (Inactive) [ 2012 Dec 04 ]

(8) Division by zero possible when testing expressions

tomtom CLOSED. Created ZBX-5944

Comment by Toms (Inactive) [ 2012 Dec 04 ]

(9) duplicate code in makeExpression():

if ($operand !== null && $key != $last_key) {
    $expression .= ' '.$operand.' ';
}

sasha RESOLVED in r31883

tomtom CLOSED

Comment by Toms (Inactive) [ 2012 Dec 04 ]

(10)
Have simple trigger expression:

{asd:key[ГУГЛ].last(0)}

=0
Open expression constructor
Edit this expression with value "1)" for N
Click replace
Error message appears
Edit this expression again with value "1" for N
Error still appears

sasha RESOLVED in r31890

tomtom CLOSED

Comment by Toms (Inactive) [ 2012 Dec 05 ]

TESTED

Comment by Toms (Inactive) [ 2012 Dec 06 ]

(11) ZBX - 5884 - 18 fix
When in trigger template entered invalid function like "lasta", error message is displayed for each child item as well:

Incorrect trigger function "lasta" provided in expression. Unknown function.
Incorrect trigger function "lasta" provided in expression. Unknown function.
Incorrect trigger function "lasta" provided in expression. Unknown function.

before was:

Incorrect trigger function "lasta(#2,2)" provided in expression. Unknown function.
Check expression part starting from "

{Exp Temp 001:agent.ping.lasta(#2,2)}

=23".

sasha RESOLVED in r31945.

jelisejev CLOSED.

Comment by Toms (Inactive) [ 2012 Dec 06 ]

(12) typo in class.ctrigger.php line: $expressionData = new CTriggerExpression($object['expression']);
unnecessary parameter

sasha RESOLVED in r31943.

jelisejev CLOSED.

Comment by Alexander Vladishev [ 2012 Dec 07 ]

Fixed in version pre-1.8.16 r31955, pre-2.0.5 r31993 and pre-2.1.0 (trunk) r31994

Generated at Fri Mar 29 10:47:54 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.