From 54777f9614affa45e62b144c9cc4e12c943bc4a9 Mon Sep 17 00:00:00 2001 From: Faustin Date: Mon, 13 Jun 2022 14:33:23 +0200 Subject: [PATCH 1/3] array productCombinations implicitly converted to a boolean --- htdocs/variants/combinations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 9e1d791a626..b6ffd948bd6 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -915,7 +915,7 @@ if (!empty($id) || !empty($ref)) { print 'id.'">'.img_delete().''; print ''; print ''; - if ($productCombinations || $massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if (!empty($productCombinations) || $massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; if (in_array($prodstatic->id, $arrayofselected)) { $selected = 1; From 6c9d177040f62939d70b8e22915d014329c11053 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Mon, 13 Jun 2022 15:17:36 +0200 Subject: [PATCH 2/3] FIX: warning (php7) / fatal (php8) if dol_eval returns a non-empty, non-string value --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 45e2d51c344..3ee5a6a995a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8505,7 +8505,7 @@ function verifCond($strToEvaluate) //dol_eval($str, 0, 1, '2'); // The dol_eval must contains all the global $xxx used into a condition //var_dump($strToEvaluate); $rep = dol_eval($strToEvaluate, 1, 1, '1'); // The dol_eval must contains all the global $xxx for all variables $xxx found into the string condition - $rights = (($rep && strpos($rep, 'Bad string syntax to evaluate') === false) ? true : false); + $rights = $rep && !is_string($rep) || strpos($rep, 'Bad string syntax to evaluate') === false; //var_dump($rights); } return $rights; From 4403fdc29c5941a4418312776dcc7508847faa1e Mon Sep 17 00:00:00 2001 From: atm-florian Date: Tue, 14 Jun 2022 09:46:15 +0200 Subject: [PATCH 3/3] Missing parentheses around or (||) condition --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3ee5a6a995a..955043637c5 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8505,7 +8505,7 @@ function verifCond($strToEvaluate) //dol_eval($str, 0, 1, '2'); // The dol_eval must contains all the global $xxx used into a condition //var_dump($strToEvaluate); $rep = dol_eval($strToEvaluate, 1, 1, '1'); // The dol_eval must contains all the global $xxx for all variables $xxx found into the string condition - $rights = $rep && !is_string($rep) || strpos($rep, 'Bad string syntax to evaluate') === false; + $rights = $rep && (!is_string($rep) || strpos($rep, 'Bad string syntax to evaluate') === false); //var_dump($rights); } return $rights;