summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorSimon Wisselink <wisskid@users.noreply.github.com>2022-02-06 21:54:54 +0100
committerGitHub <noreply@github.com>2022-02-06 21:54:54 +0100
commitf90348971b8c91f527ed3b3436f319d7ea22d825 (patch)
tree84b44816d6f012233f7713c1044b75ef2e8fe7c7 /libs
parent9e0536de18b53ba193364291ef0303b0ab9903e1 (diff)
parent02633ecaba4a019f583df718345d55aad424e2ac (diff)
downloadsmarty-f90348971b8c91f527ed3b3436f319d7ea22d825.tar.gz
smarty-f90348971b8c91f527ed3b3436f319d7ea22d825.tar.bz2
smarty-f90348971b8c91f527ed3b3436f319d7ea22d825.zip
Merge pull request #722 from kochichi/bugfix/721
math equation return warning: max(x, y)
Diffstat (limited to 'libs')
-rw-r--r--libs/plugins/function.math.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php
index fd5b3d16..8560e944 100644
--- a/libs/plugins/function.math.php
+++ b/libs/plugins/function.math.php
@@ -69,7 +69,7 @@ function smarty_function_math($params, $template)
// Adapted from https://www.php.net/manual/en/function.eval.php#107377
$number = '(?:\d+(?:[,.]\d+)?|pi|π)'; // What is a number
$functionsOrVars = '((?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))';
- $operators = '[+\/*\^%-]'; // Allowed math operators
+ $operators = '[,+\/*\^%-]'; // Allowed math operators
$regexp = '/^(('.$number.'|'.$functionsOrVars.'|('.$functionsOrVars.'\s*\((?1)+\)|\((?1)+\)))(?:'.$operators.'(?1))?)+$/';
if (!preg_match($regexp, $equation)) {