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
diff options
context:
space:
mode:
-rw-r--r--ui/include/classes/data/CHistFunctionData.php5
-rw-r--r--ui/tests/unit/include/classes/validators/CHistFunctionValidatorTest.php2
2 files changed, 6 insertions, 1 deletions
diff --git a/ui/include/classes/data/CHistFunctionData.php b/ui/include/classes/data/CHistFunctionData.php
index 768fe6d468d..4160e6f179c 100644
--- a/ui/include/classes/data/CHistFunctionData.php
+++ b/ui/include/classes/data/CHistFunctionData.php
@@ -249,7 +249,10 @@ final class CHistFunctionData {
['rules' => [
['type' => 'regexp', 'pattern' => '/^(mad|stddevpop|stddevsamp)$/']
], 'required' => false],
- ['rules' => [['type' => 'number', 'min' => 7]], 'required' => false]
+ ['rules' => [
+ ['type' => 'regexp', 'pattern' => '/^\d+$/'],
+ ['type' => 'number', 'min' => 7]
+ ], 'required' => false]
],
'trendsum' => [
['rules' => [['type' => 'query']]],
diff --git a/ui/tests/unit/include/classes/validators/CHistFunctionValidatorTest.php b/ui/tests/unit/include/classes/validators/CHistFunctionValidatorTest.php
index 92435b6182b..7f8c24ca248 100644
--- a/ui/tests/unit/include/classes/validators/CHistFunctionValidatorTest.php
+++ b/ui/tests/unit/include/classes/validators/CHistFunctionValidatorTest.php
@@ -692,6 +692,7 @@ class CHistFunctionValidatorTest extends TestCase {
['trendstl(/host/key, 1d:now/M-1w, 1h, 1d, 1, 0)', ['calculated' => true], ['rc' => false, 'error' => 'invalid sixth parameter in function "trendstl"']],
['trendstl(/host/key, 1h:now/d, 1h, 1d, 1, "test")', ['calculated' => true], ['rc' => false, 'error' => 'invalid sixth parameter in function "trendstl"']],
['trendstl(/host/key, 240h:now/h, 1h, 1d, 1, "mad", 0)', ['calculated' => true], ['rc' => false, 'error' => 'invalid seventh parameter in function "trendstl"']],
+ ['trendstl(/host/key, 240h:now/h, 1h, 1d, 1, "mad", 7.5)', ['calculated' => true], ['rc' => false, 'error' => 'invalid seventh parameter in function "trendstl"']],
['trendstl(/host/key)', [], ['rc' => false, 'error' => 'mandatory parameter is missing in function "trendstl"']],
['trendstl(/host/key, 0, 1h, 1)', [], ['rc' => false, 'error' => 'invalid second parameter in function "trendstl"']],
['trendstl(/host/key, #0, 1h, 1)', [], ['rc' => false, 'error' => 'invalid second parameter in function "trendstl"']],
@@ -708,6 +709,7 @@ class CHistFunctionValidatorTest extends TestCase {
['trendstl(/host/key, 240h:now/h, 365d, 1d)', [], ['rc' => true, 'error' => null]],
['trendstl(/host/key, 240h:now/h, 365d, 1d, 1.53)', [], ['rc' => true, 'error' => null]],
['trendstl(/host/key, {$PERIOD}:{$TIMESHIFT}, 1h, 1d)', ['usermacros' => true], ['rc' => true, 'error' => null]],
+ ['trendstl(/host/key, 240h:now/h, 1h, 1d, 1, "mad", 7)', ['calculated' => true], ['rc' => true, 'error' => null]],
['trendstl(/host/key, {$PARAM2}, {$MACRO3}, {$MACRO4}, {$MACRO5}, {$MACRO6}, {$MACRO7})', ['usermacros' => true], ['rc' => true, 'error' => null]],
['trendstl(/host/key, {#PARAM2}, {#PARAM3}, {#PARAM4}), {#PARAM5}), {#PARAM6}), {#PARAM7})', ['lldmacros' => true], ['rc' => true, 'error' => null]],
['trendstl(/host/key, {$PARAM2}, {#PARAM3}, {$PARAM4}), {#PARAM5}), {$PARAM6}), {#PARAM7})', ['lldmacros' => true, 'usermacros' => true], ['rc' => true, 'error' => null]],