mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
refactor redundant code (#31331)
This commit is contained in:
committed by
GitHub
parent
e63fcc9fed
commit
6ba48c5db2
@@ -10589,27 +10589,15 @@ function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1'
|
||||
|
||||
//print $s."<br>\n";
|
||||
if ($returnvalue) {
|
||||
if ($hideerrors) {
|
||||
ob_start(); // An evaluation has no reason to output data
|
||||
$isObBufferActive = true;
|
||||
$tmps = @eval('return '.$s.';');
|
||||
$tmpo = ob_get_clean();
|
||||
$isObBufferActive = false;
|
||||
if ($tmpo) {
|
||||
print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s;
|
||||
}
|
||||
return $tmps;
|
||||
} else {
|
||||
ob_start(); // An evaluation has no reason to output data
|
||||
$isObBufferActive = true;
|
||||
$tmps = eval('return '.$s.';');
|
||||
$tmpo = ob_get_clean();
|
||||
$isObBufferActive = false;
|
||||
if ($tmpo) {
|
||||
print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s;
|
||||
}
|
||||
return $tmps;
|
||||
ob_start(); // An evaluation has no reason to output data
|
||||
$isObBufferActive = true;
|
||||
$tmps = $hideerrors ? @eval('return ' . $s . ';') : eval('return ' . $s . ';');
|
||||
$tmpo = ob_get_clean();
|
||||
$isObBufferActive = false;
|
||||
if ($tmpo) {
|
||||
print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: ' . $s;
|
||||
}
|
||||
return $tmps;
|
||||
} else {
|
||||
dol_syslog('Do not use anymore dol_eval with param returnvalue=0', LOG_WARNING);
|
||||
if ($hideerrors) {
|
||||
|
||||
Reference in New Issue
Block a user