From 63a1daa091eb3b5dde43ce4982b81a598d2646d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 26 Aug 2022 19:27:38 +0200 Subject: [PATCH] Clean code --- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/fourn/commande/list.php | 2 +- test/phpunit/CodingPhpTest.php | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e76106e44c6..71161d77c64 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -432,8 +432,8 @@ function GETPOSTISSET($paramname) * Can be used before GETPOST to know if the $check param of GETPOST need to check an array or a string * * @param string $paramname Name or parameter to test - * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get) - * @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty) + * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get) + * @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty) */ function GETPOSTISARRAY($paramname, $method = 0) { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 8d03dbb387c..354c92eb534 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -120,7 +120,7 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); -if (is_array(GETPOST('search_status', 'none'))) { // 'none' because we want to know type before sanitizing +if (GETPOSTISARRAY('search_status')) { $search_status = join(',', GETPOST('search_status', 'array:intcomma')); } else { $search_status = (GETPOST('search_status', 'intcomma') != '' ? GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma')); diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 6388d3985e7..dd0e6827ec1 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -464,7 +464,9 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase //var_dump($val); if (!in_array($val[1], array( "'replacestring'", "'htmlheader'", "'WEBSITE_HTML_HEADER'", "'WEBSITE_CSS_INLINE'", "'WEBSITE_JS_INLINE'", "'WEBSITE_MANIFEST_JSON'", "'PAGE_CONTENT'", "'WEBSITE_README'", - "'search_status'", '"mysqldump"', '"postgresqldump"', "'db_pass_root'", "'db_pass'", '"pass"', '"pass1"', '"pass2"', '"password"', "'password'", '"MAIN_MAIL_SMTPS_PW"'))) { + '"mysqldump"', '"postgresqldump"', + "'db_pass_root'", "'db_pass'", '"pass"', '"pass1"', '"pass2"', '"password"', "'password'", + '"MAIN_MAIL_SMTPS_PW"', '"MAIN_MAIL_SMTPS_PW_EMAILING"', '"MAIN_MAIL_SMTPS_PW_TICKET"'))) { $ok=false; break; }