From 25557e3dc2c3291798125fdd79f5167227b4655f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 30 Jan 2024 23:03:43 +0100 Subject: [PATCH 1/5] fix phpstan --- htdocs/webportal/class/html.formwebportal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webportal/class/html.formwebportal.class.php b/htdocs/webportal/class/html.formwebportal.class.php index 0371f0694b8..d7f12bc735e 100644 --- a/htdocs/webportal/class/html.formwebportal.class.php +++ b/htdocs/webportal/class/html.formwebportal.class.php @@ -245,7 +245,7 @@ class FormWebPortal extends Form * @param string $filedir Full path to directory to scan * @param string $filter Filter filenames on this regex string (Example: '\.pdf$') * @param string $morecss Add more css to the download picto - * @param string $allfiles 0=Only generated docs, 1=All files + * @param int $allfiles 0=Only generated docs, 1=All files * @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles */ public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '', $morecss = '', $allfiles = 0) From 5655eb387cccaa9ab61ef6009c27ed5d9de6b82f Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 31 Jan 2024 00:41:06 +0100 Subject: [PATCH 2/5] Qual: Fix annotation # Qual: Fix annotation The typing hint was incorrect, corrected. --- htdocs/core/class/utils.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 3a1e6e34a96..42880621de5 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -52,7 +52,7 @@ class Utils public $output; /** - * @var array{'commandbackuplastdone': string, 'commandbackuptorun': string} Used by Cron method to return data + * @var array{commandbackuplastdone:string,commandbackuptorun:string} Used by Cron method to return data */ public $result; From d8784f129443fa1cd894e07438f6511123a212dc Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 31 Jan 2024 01:28:25 +0100 Subject: [PATCH 3/5] Fix: Always return value in get_element_list # Fix: Always return value in get_element_list get_element_list did not always return a value. Fixed. --- htdocs/projet/class/project.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6264dbf3f72..893195306fc 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -916,6 +916,7 @@ class Project extends CommonObject } else { dol_print_error($this->db); } + return -1; } /** From 485dec120fe39ef96b44b0f50dde708e8f1c3797 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 31 Jan 2024 01:42:15 +0100 Subject: [PATCH 4/5] Fix: Always return value as suggested # Fix: Always return value as suggested Always return a value in doAction (as per PHPDoc type hint). --- htdocs/core/class/canvas.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 41086045e7a..372e721acda 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -224,5 +224,6 @@ class Canvas $ret = $this->control->doActions($action, $id); return $ret; } + return null; } } From 23b73eb714b5b4e34485713c93324a279ff3b8c5 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 31 Jan 2024 01:38:15 +0100 Subject: [PATCH 5/5] Fix: dol_eval - return value in case of exception. # Fix: dol_eval - return value in case of exception. dol_eval did not return a value in case of exception. Fixed. --- htdocs/core/lib/functions.lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 95ff513a50e..8d19ca4cf4f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9809,6 +9809,11 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' $error = 'dol_eval try/catch error : '; $error .= $e->getMessage(); dol_syslog($error, LOG_WARNING); + if ($returnvalue) { + return 'Exception during evaluation: '.$s; + } else { + return ''; + } } }