forked from Wavyzz/dolibarr
Merge pull request #29204 from mdeweerd/fix/projet_abs
Fix fatal (PHP8.X) type issue with abs, and amend dol_eval return type
This commit is contained in:
@@ -8299,7 +8299,12 @@ abstract class CommonObject
|
|||||||
$value = '<span class="opacitymedium">'.$langs->trans("Encrypted").'</span>';
|
$value = '<span class="opacitymedium">'.$langs->trans("Encrypted").'</span>';
|
||||||
//$value = preg_replace('/./i', '*', $value);
|
//$value = preg_replace('/./i', '*', $value);
|
||||||
} elseif ($type == 'array') {
|
} elseif ($type == 'array') {
|
||||||
|
if (is_array($value)) {
|
||||||
$value = implode('<br>', $value);
|
$value = implode('<br>', $value);
|
||||||
|
} else {
|
||||||
|
dol_syslog(__METHOD__.' Expected array from dol_eval, but got '.gettype($value), LOG_ERR);
|
||||||
|
return 'Error unexpected result from code evaluation';
|
||||||
|
}
|
||||||
} else { // text|html|varchar
|
} else { // text|html|varchar
|
||||||
$value = dol_htmlentitiesbr($value);
|
$value = dol_htmlentitiesbr($value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9925,7 +9925,7 @@ function verifCond($strToEvaluate, $onlysimplestring = '1')
|
|||||||
* @param string $onlysimplestring '0' (deprecated, do not use it anymore)=Accept all chars,
|
* @param string $onlysimplestring '0' (deprecated, do not use it anymore)=Accept all chars,
|
||||||
* '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';',
|
* '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';',
|
||||||
* '2' (used for example for the compute property of extrafields)=Accept also '[]'
|
* '2' (used for example for the compute property of extrafields)=Accept also '[]'
|
||||||
* @return mixed Nothing or return result of eval
|
* @return void|string Nothing or return result of eval (even if type can be int, it is safer to assume string and find all potential typing issues as abs(dol_eval(...)).
|
||||||
* @see verifCond()
|
* @see verifCond()
|
||||||
* @phan-suppress PhanPluginUnsafeEval
|
* @phan-suppress PhanPluginUnsafeEval
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ $arrayfields = array();
|
|||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
// If $val['visible']==0, then we never show the field
|
// If $val['visible']==0, then we never show the field
|
||||||
if (!empty($val['visible'])) {
|
if (!empty($val['visible'])) {
|
||||||
$visible = dol_eval($val['visible'], 1, 1, '1');
|
$visible = (int) dol_eval($val['visible'], 1, 1, '1');
|
||||||
$arrayfields['p.'.$key] = array(
|
$arrayfields['p.'.$key] = array(
|
||||||
'label' => $val['label'],
|
'label' => $val['label'],
|
||||||
'checked' => (($visible < 0) ? 0 : 1),
|
'checked' => (($visible < 0) ? 0 : 1),
|
||||||
|
|||||||
Reference in New Issue
Block a user