Try catch on eval

This commit is contained in:
Laurent Destailleur
2020-09-27 21:10:27 +02:00
parent 4ca481335b
commit 1aaf1fe357

View File

@@ -245,9 +245,16 @@ function dol_json_decode($json, $assoc = false)
$out = _unval($out);
$array = array();
// Return an array
if ($out != '') eval('$array = '.$out.';');
else $array = array();
if ($out != '') {
try {
eval('$array = '.$out.';');
} catch(Exception $e) {
$array = array();
}
}
// Return an object
if (!$assoc)