mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
re-enabled hex-constant. i hope in a sane way this time.
This commit is contained in:
@@ -35,12 +35,12 @@ function smarty_function_math($params, &$smarty)
|
||||
}
|
||||
|
||||
// match all vars in equation, make sure all are passed
|
||||
preg_match_all("!([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
|
||||
preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
|
||||
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
|
||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
||||
|
||||
foreach($match[1] as $curr_var) {
|
||||
if (!in_array($curr_var,array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
|
||||
if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
|
||||
$smarty->trigger_error("math: function call $curr_var not allowed");
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user