Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorGregory Chalenko <gregory.chalenko@zabbix.com>2021-05-10 15:40:22 +0300
committerGregory Chalenko <gregory.chalenko@zabbix.com>2021-05-10 15:40:22 +0300
commitafed3e3c3669bec757c1b5eb92968f87ea1c9278 (patch)
tree8445b5934d8d4f310024b008fa947b75e3486697 /ui
parent1d75c3932a0c5e03e276de239421dbdb3c5cce46 (diff)
A.F....... [ZBXNEXT-114,ZBXNEXT-6572] fixed incorrect flags; fixed method description
Diffstat (limited to 'ui')
-rw-r--r--ui/include/classes/api/services/CValueMap.php16
-rw-r--r--ui/include/classes/validators/CApiInputValidator.php5
2 files changed, 14 insertions, 7 deletions
diff --git a/ui/include/classes/api/services/CValueMap.php b/ui/include/classes/api/services/CValueMap.php
index ba7c1ce7594..60130ef0e6e 100644
--- a/ui/include/classes/api/services/CValueMap.php
+++ b/ui/include/classes/api/services/CValueMap.php
@@ -354,17 +354,19 @@ class CValueMap extends CApiService {
],
[
'if' => ['field' => 'type', 'in' => implode(',', [VALUEMAP_MAPPING_TYPE_GREATER_EQUAL, VALUEMAP_MAPPING_TYPE_LESS_EQUAL])],
- 'type' => API_FLOAT | API_NOT_EMPTY,
+ 'type' => API_FLOAT,
'length' => DB::getFieldLength('valuemap_mapping', 'value')
],
[
'if' => ['field' => 'type', 'in' => implode(',', [VALUEMAP_MAPPING_TYPE_IN_RANGE])],
- 'type' => API_NUMERIC_RANGES | API_NOT_EMPTY,
+ 'type' => API_NUMERIC_RANGES,
+ 'flags' => API_NOT_EMPTY,
'length' => DB::getFieldLength('valuemap_mapping', 'value')
],
[
'if' => ['field' => 'type', 'in' => implode(',', [VALUEMAP_MAPPING_TYPE_REGEXP])],
- 'type' => API_REGEX | API_NOT_EMPTY,
+ 'type' => API_REGEX,
+ 'flags' => API_NOT_EMPTY,
'length' => DB::getFieldLength('valuemap_mapping', 'value')
],
[
@@ -430,17 +432,19 @@ class CValueMap extends CApiService {
],
[
'if' => ['field' => 'type', 'in' => implode(',', [VALUEMAP_MAPPING_TYPE_GREATER_EQUAL, VALUEMAP_MAPPING_TYPE_LESS_EQUAL])],
- 'type' => API_FLOAT | API_NOT_EMPTY,
+ 'type' => API_FLOAT,
'length' => DB::getFieldLength('valuemap_mapping', 'value')
],
[
'if' => ['field' => 'type', 'in' => implode(',', [VALUEMAP_MAPPING_TYPE_IN_RANGE])],
- 'type' => API_NUMERIC_RANGES | API_NOT_EMPTY,
+ 'type' => API_NUMERIC_RANGES,
+ 'flags' => API_NOT_EMPTY,
'length' => DB::getFieldLength('valuemap_mapping', 'value')
],
[
'if' => ['field' => 'type', 'in' => implode(',', [VALUEMAP_MAPPING_TYPE_REGEXP])],
- 'type' => API_REGEX | API_NOT_EMPTY,
+ 'type' => API_REGEX,
+ 'flags' => API_NOT_EMPTY,
'length' => DB::getFieldLength('valuemap_mapping', 'value')
],
[
diff --git a/ui/include/classes/validators/CApiInputValidator.php b/ui/include/classes/validators/CApiInputValidator.php
index a5c55d3f619..e3e35419b43 100644
--- a/ui/include/classes/validators/CApiInputValidator.php
+++ b/ui/include/classes/validators/CApiInputValidator.php
@@ -254,6 +254,7 @@ class CApiInputValidator {
case API_JSONRPC_PARAMS:
case API_JSONRPC_ID:
case API_DATE:
+ case API_NUMERIC_RANGES:
return true;
case API_OBJECT:
@@ -2189,6 +2190,8 @@ class CApiInputValidator {
* 30,-10,0.7,-0.5
*
* @param array $rule
+ * @param int $rule['flags'] (optional) API_NOT_EMPTY
+ * @param int $rule['length'] (optional)
* @param mixed $data
* @param string $path
* @param string $error
@@ -2198,7 +2201,7 @@ class CApiInputValidator {
private static function validateNumericRanges($rule, &$data, $path, &$error) {
$flags = array_key_exists('flags', $rule) ? $rule['flags'] : 0x00;
- if (self::checkStringUtf8(0, $data, $path, $error) === false) {
+ if (self::checkStringUtf8($flags & API_NOT_EMPTY, $data, $path, $error) === false) {
return false;
}