mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
FIX dol_eval with function starting with !
This commit is contained in:
@@ -9329,10 +9329,6 @@ function isStringVarMatching($var, $regextext, $matchrule = 1)
|
||||
*/
|
||||
function verifCond($strToEvaluate)
|
||||
{
|
||||
global $conf; // Read of const is done with getDolGlobalString() but we need $conf->currency for example
|
||||
global $user, $langs;
|
||||
global $leftmenu;
|
||||
|
||||
//print $strToEvaluate."<br>\n";
|
||||
$rights = true;
|
||||
if (isset($strToEvaluate) && $strToEvaluate !== '') {
|
||||
@@ -9418,8 +9414,8 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
||||
$scheck = preg_replace('/->[a-zA-Z0-9_]+\(/', '->__METHOD__', $s); // accept parenthesis in '...->method(...'
|
||||
$scheck = preg_replace('/^\(/', '__PARENTHESIS__', $scheck); // accept parenthesis in '(...'
|
||||
$scheck = preg_replace('/\s\(/', '__PARENTHESIS__', $scheck); // accept parenthesis in '... ('
|
||||
$scheck = preg_replace('/^[a-zA-Z0-9_]+\(/', '$1__FUNCTION__', $scheck); // accept parenthesis in 'function('
|
||||
$scheck = preg_replace('/\s[a-zA-Z0-9_]+\(/', '$1__FUNCTION__', $scheck); // accept parenthesis in '... function('
|
||||
$scheck = preg_replace('/^!?[a-zA-Z0-9_]+\(/', '$1__FUNCTION__', $scheck); // accept parenthesis in 'function(' and '!function('
|
||||
$scheck = preg_replace('/\s!?[a-zA-Z0-9_]+\(/', '$1__FUNCTION__', $scheck); // accept parenthesis in '... function(' and '... !function('
|
||||
$scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'... or isStringVarMatching('leftmenu', '(aaa|bbb)')
|
||||
//print 'scheck='.$scheck." : ".strpos($scheck, '(')."\n";
|
||||
if (strpos($scheck, '(') !== false) {
|
||||
|
||||
Reference in New Issue
Block a user