diff options
author | Gregory Chalenko <gregory.chalenko@zabbix.com> | 2021-05-06 13:29:04 +0300 |
---|---|---|
committer | Gregory Chalenko <gregory.chalenko@zabbix.com> | 2021-05-06 13:29:04 +0300 |
commit | 7cf7ed1dd9ff722cef0d55bb2a6d64750ea5042c (patch) | |
tree | 04dca68d3df77ddc2a9b5a54921180acbb031f11 /ui/app/controllers | |
parent | da47886dd20da6e390b5ecb25b607a4d6f29a320 (diff) |
A.F....... [ZBXNEXT-114,ZBXNEXT-6572] fixed undefined index
Diffstat (limited to 'ui/app/controllers')
-rw-r--r-- | ui/app/controllers/CControllerPopupValueMapUpdate.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ui/app/controllers/CControllerPopupValueMapUpdate.php b/ui/app/controllers/CControllerPopupValueMapUpdate.php index f707840833c..1608182614a 100644 --- a/ui/app/controllers/CControllerPopupValueMapUpdate.php +++ b/ui/app/controllers/CControllerPopupValueMapUpdate.php @@ -74,7 +74,7 @@ class CControllerPopupValueMapUpdate extends CController { } $mappings = array_filter($this->getInput('mappings', []), function ($mapping) { - return ($mapping['value'] !== '' || $mapping['newvalue'] !== ''); + return array_key_exists('value', $mapping) && ($mapping['value'] !== '' || $mapping['newvalue'] !== ''); }); if (!$mappings) { @@ -82,7 +82,10 @@ class CControllerPopupValueMapUpdate extends CController { return false; } - $type_values = []; + $type_uniq = array_fill_keys([VALUEMAP_MAPPING_TYPE_EQUAL, VALUEMAP_MAPPING_TYPE_GREATER_EQUAL, + VALUEMAP_MAPPING_TYPE_LESS_EQUAL, VALUEMAP_MAPPING_TYPE_IN_RANGE, VALUEMAP_MAPPING_TYPE_REGEXP + ], [] + ); $number_parser = new CNumberParser(); $range_parser = new CRangesParser(['with_minus' => true, 'with_float' => true, 'with_suffix' => true]); @@ -97,7 +100,7 @@ class CControllerPopupValueMapUpdate extends CController { return false; } - if (array_key_exists($value, $type_values[$type])) { + if (array_key_exists($value, $type_uniq[$type])) { error(_s('Incorrect value for field "%1$s": %2$s.', _('Value'), _s('value %1$s already exists', '('.$value.')')) ); |