FIX 12.0 - when the cronjob 'params' field is empty, the cron method is called with one empty string param instead of no params at all

This commit is contained in:
Florian Mortgat 2020-11-20 19:12:59 +01:00
parent 823e399d8d
commit f7228d96af

View File

@ -1052,7 +1052,10 @@ class Cronjob extends CommonObject
$object = new $this->objectname($this->db);
if ($this->entity > 0) $object->entity = $this->entity; // We work on a dedicated entity
$params_arr = array_map('trim', explode(",", $this->params));
$params_arr = array();
if (!empty($this->params) || $this->params === '0'){
$params_arr = array_map('trim', explode(",", $this->params));
}
if (!is_array($params_arr))
{
@ -1113,7 +1116,7 @@ class Cronjob extends CommonObject
}
dol_syslog(get_class($this)."::run_jobs ".$this->libname."::".$this->methodename."(".$this->params.");", LOG_DEBUG);
$params_arr = explode(", ", $this->params);
$params_arr = explode(", ", $this->params);
if (!is_array($params_arr))
{
$result = call_user_func($this->methodename, $this->params);