Merge pull request #23760 from rept0id/develop
Fix : Updated function dol_eval, added error handling
This commit is contained in:
commit
53b64feb7b
@ -8946,6 +8946,7 @@ function verifCond($strToEvaluate)
|
||||
*/
|
||||
function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1')
|
||||
{
|
||||
try {
|
||||
// Only global variables can be changed by eval function and returned to caller
|
||||
global $db, $langs, $user, $conf, $website, $websitepage;
|
||||
global $action, $mainmenu, $leftmenu;
|
||||
@ -9049,6 +9050,13 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
||||
eval($s);
|
||||
}
|
||||
}
|
||||
} catch (Error $e) {
|
||||
$error = 'Caught error : ';
|
||||
$error .= $e->getMessage() . ', ';
|
||||
$error .= 'Trace : ';
|
||||
$error .= json_encode($e->getTrace());
|
||||
error_log($error, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user