[ZBX-12115] lastvalue & prevvalue for item return 0 for character fields if empty Created: 2017 Apr 27 Updated: 2024 Apr 10 Resolved: 2018 Jun 28 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A) |
Affects Version/s: | None |
Fix Version/s: | 4.0.0alpha9, 4.0 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | Garry Shtern | Assignee: | Miks Kronkalns |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Team: | Team D |
Team: | Team D |
Sprint: | Sprint 33, Sprint 34, Sprint 35, Sprint 36, Sprint 37 |
Story Points: | 0.5 |
Description |
This piece of code seems wrong: if (isset($requestedOutput['lastvalue'])) { $item['lastvalue'] = $lastHistory ? $lastHistory['value'] : '0'; } if (isset($requestedOutput['prevvalue'])) { $item['prevvalue'] = $prevHistory ? $prevHistory['value'] : '0'; } |
Comments |
Comment by Aigars Kadikis [ 2018 Mar 15 ] |
Why do you think this code is wrong? What are your suggestions? Regards, |
Comment by Garry Shtern [ 2018 Jun 01 ] |
If the value is not defined, I expect it to return null. '0' has a potential of conflicting with a legitimate string value of '0'. |
Comment by Miks Kronkalns [ 2018 Jun 26 ] |
Fixed in:
|