From e20d669e34276d30695c83454cd2ecbad3551d5c Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:08:47 +0100 Subject: [PATCH 1/5] Fix : prevent fatal error --- htdocs/core/class/validate.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/validate.class.php b/htdocs/core/class/validate.class.php index 1b2447dc23a..389bb708e82 100644 --- a/htdocs/core/class/validate.class.php +++ b/htdocs/core/class/validate.class.php @@ -61,6 +61,11 @@ class Validate $this->outputLang = $outputLang; } + if (!is_object($this->outputLang) || !method_exists($outputLang, 'load')) { + return false; + } + + /** @var Translate $outputLang */ $outputLang->load('validate'); $this->db = $db; @@ -212,7 +217,7 @@ class Validate /** * Check Duration validity * - * @param string $duration to validate + * @param mixed $duration to validate * @return boolean Validity is ok or not */ public function isDuration($duration) From 5449d57d260573638a4e0a03be0787dd8fe1953b Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:19:51 +0100 Subject: [PATCH 2/5] fix variable does not seem to be defined for all execution --- htdocs/core/lib/images.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 0ccb6a415fc..6b973d89887 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -388,7 +388,7 @@ function dolRotateImage($file_path) * Add exif orientation correction for image * * @param string $fileSource Full path to source image to rotate - * @param string $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly + * @param string|bool $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly * @param int $quality output image quality * @return bool : true on success or false on failure or gd img if $fileDest is false. */ @@ -630,7 +630,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } // replace image with good orientation - if (!empty($rotated)) { + if (!empty($rotated) && isset($trueImgWidth) && isset($trueImgHeight)) { $img = $rotated; $imgWidth = $trueImgWidth; $imgHeight = $trueImgHeight; From 0f587a37e2def320139d37031086cf6215c75b8d Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:36:44 +0100 Subject: [PATCH 3/5] fix missing var definition --- htdocs/core/modules/DolibarrModules.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index b90ea227037..675b0a80ab9 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -348,8 +348,10 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $hidden = false; - - + /** + * @var string url to check for module update + */ + public $url_last_version; /** From 38539dace3b1b48dec97378bbdb947484c768f32 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:44:10 +0100 Subject: [PATCH 4/5] fix test --- htdocs/theme/eldy/manifest.json.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index ec6472c80e6..6f3dc2e9cbc 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -101,7 +101,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) { $iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath; if (is_readable($iconPath)) { $imgSize = getimagesize($iconPath); - if ($imgSize) { + if (!empty($imgSize)) { $icon = new stdClass(); $icon->src = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($iconRelativePath); $icon->sizes = $imgSize[0]."x".$imgSize[1]; From 33ea8e850b77177a84c406ad2587f2fd78e8f638 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 28 Dec 2021 19:47:58 +0100 Subject: [PATCH 5/5] Remove not defined param --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6d8b54d1954..f531d221aff 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -747,7 +747,7 @@ class Project extends CommonObject 'fk_projet' => $projectkey, 'ids' => $ids, ); - $reshook = $hookmanager->executeHooks('getElementList', $parameters, $object, $action); + $reshook = $hookmanager->executeHooks('getElementList', $parameters); if ($reshook > 0) { $sql = $hookmanager->resPrint; } else {