From f7228d96af13d800324f75d711ba05cc1df042b4 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 20 Nov 2020 19:12:59 +0100 Subject: [PATCH] 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 --- htdocs/cron/class/cronjob.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 39220f0cebe..ba7adfd320f 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -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);