Skip to content

Commit

Permalink
Add change in regex for PRCE (PHP < 7.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
wisskid committed Sep 12, 2022
1 parent f3c9919 commit 2272e4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/plugins/function.math.php
Expand Up @@ -70,7 +70,7 @@ function smarty_function_math($params, $template)
$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
$regexp = '/^(('.$number.'|'.$functionsOrVars.'|('.$functionsOrVars.'\s*\((?1)*\)|\((?1)+\)))(?:'.$operators.'(?1))?)+$/';
$regexp = '/^(('.$number.'|'.$functionsOrVars.'|('.$functionsOrVars.'\s*\((?1)*\)|\((?1)*\)))(?:'.$operators.'(?1))?)+$/';

if (!preg_match($regexp, $equation)) {
trigger_error("math: illegal characters", E_USER_WARNING);
Expand Down

0 comments on commit 2272e4d

Please sign in to comment.