mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-03 05:41:37 +01:00
math equation return warning: math: illegal character for : {math equation="max(x, y)" x=$x y=$y}
This commit is contained in:
committed by
Simon Wisselink
parent
99085d8dc6
commit
9f47b059ed
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user