diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 7a48cb1f1cb..a2db0936623 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -1326,12 +1326,6 @@ parameters: count: 1 path: ../../../htdocs/admin/index.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: ../../../htdocs/admin/knowledgemanagement.php - - message: '#^Offset ''includedocgeneration'' on array\{label\: ''KnowledgeManagement'', includerefgeneration\: 1, includedocgeneration\: 0, class\: ''KnowledgeRecord''\} in empty\(\) always exists and is always falsy\.$#' identifier: empty.offset @@ -1656,12 +1650,6 @@ parameters: count: 1 path: ../../../htdocs/admin/system/about.php - - - message: '#^Variable \$conffiletoshowshort might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/admin/system/constall.php - - message: '#^Loose comparison using \=\= between 0\|1 and 2 will always evaluate to false\.$#' identifier: equal.alwaysFalse @@ -1680,12 +1668,6 @@ parameters: count: 1 path: ../../../htdocs/admin/system/dolibarr.php - - - message: '#^Variable \$conffiletoshowshort might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/admin/system/dolibarr.php - - message: '#^Variable \$ignore in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -2190,12 +2172,6 @@ parameters: count: 1 path: ../../../htdocs/asset/class/asset.class.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 2 - path: ../../../htdocs/asset/class/asset.class.php - - message: '#^Call to function is_callable\(\) with array\{\$this\(AssetDepreciationOptions\), ''validateField''\} will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -2634,12 +2610,6 @@ parameters: count: 1 path: ../../../htdocs/bookcal/availabilities_card.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: ../../../htdocs/bookcal/availabilities_list.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -2772,12 +2742,6 @@ parameters: count: 1 path: ../../../htdocs/bookcal/calendar_document.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: ../../../htdocs/bookcal/calendar_list.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -3699,7 +3663,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 6 + count: 2 path: ../../../htdocs/comm/propal/card.php - @@ -3993,7 +3957,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 6 + count: 2 path: ../../../htdocs/commande/card.php - @@ -5424,12 +5388,6 @@ parameters: count: 1 path: ../../../htdocs/compta/paiement/cheque/card.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 3 - path: ../../../htdocs/compta/paiement/cheque/card.php - - message: '#^Call to function method_exists\(\) with \$this\(RemiseCheque\) and ''LibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -6132,12 +6090,6 @@ parameters: count: 1 path: ../../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/stats/supplier_turnover_by_prodserv.php - - message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -6168,12 +6120,6 @@ parameters: count: 1 path: ../../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - - message: '#^Variable \$result might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/compta/stats/supplier_turnover_by_thirdparty.php - - message: '#^Variable \$sql might not be defined\.$#' identifier: variable.undefined @@ -6372,12 +6318,6 @@ parameters: count: 2 path: ../../../htdocs/compta/tva/payments.php - - - message: '#^Strict comparison using \!\=\= between mixed and null will always evaluate to true\.$#' - identifier: notIdentical.alwaysTrue - count: 1 - path: ../../../htdocs/compta/tva/payments.php - - message: '#^Variable \$num might not be defined\.$#' identifier: variable.undefined @@ -6675,7 +6615,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 3 + count: 1 path: ../../../htdocs/contrat/card.php - @@ -6888,12 +6828,6 @@ parameters: count: 1 path: ../../../htdocs/contrat/note.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: ../../../htdocs/contrat/services_list.php - - message: '#^Loose comparison using \=\= between '''' and \-1 will always evaluate to false\.$#' identifier: equal.alwaysFalse @@ -6954,12 +6888,6 @@ parameters: count: 2 path: ../../../htdocs/core/actions_addupdatedelete.inc.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 4 - path: ../../../htdocs/core/actions_addupdatedelete.inc.php - - message: '#^Comparison operation "\>" between false and 0 is always false\.$#' identifier: greater.alwaysFalse @@ -6972,12 +6900,6 @@ parameters: count: 1 path: ../../../htdocs/core/actions_builddoc.inc.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../../htdocs/core/actions_builddoc.inc.php - - message: '#^Variable \$action might not be defined\.$#' identifier: variable.undefined @@ -7044,12 +6966,6 @@ parameters: count: 2 path: ../../../htdocs/core/actions_lineupdown.inc.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 2 - path: ../../../htdocs/core/actions_lineupdown.inc.php - - message: '#^Variable \$permissiontoedit might not be defined\.$#' identifier: variable.undefined @@ -7068,12 +6984,6 @@ parameters: count: 6 path: ../../../htdocs/core/actions_linkedfiles.inc.php - - - message: '#^Call to function is_array\(\) with non\-empty\-array\ will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../../htdocs/core/actions_massactions.inc.php - - message: '#^Call to function is_object\(\) with Adherent\|ConferenceOrBoothAttendee\|Contact\|Societe\|User will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7134,12 +7044,6 @@ parameters: count: 1 path: ../../../htdocs/core/actions_massactions.inc.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 3 - path: ../../../htdocs/core/actions_massactions.inc.php - - message: '#^Variable \$search_status might not be defined\.$#' identifier: variable.undefined @@ -7206,12 +7110,6 @@ parameters: count: 1 path: ../../../htdocs/core/actions_setmoduleoptions.inc.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../../htdocs/core/actions_setnotes.inc.php - - message: '#^Variable \$result might not be defined\.$#' identifier: variable.undefined @@ -9102,12 +9000,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/html.formmail.class.php - - - message: '#^Parameter \#3 \$zone of static method InfoBox\:\:listBoxes\(\) expects int, string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/core/class/html.formother.class.php - - message: '#^Property CommonObjectLine\:\:\$id \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -12252,12 +12144,6 @@ parameters: count: 3 path: ../../../htdocs/core/photos_resize.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: ../../../htdocs/core/search_page.php - - message: '#^Loose comparison using \=\= between 1 and 2 will always evaluate to false\.$#' identifier: equal.alwaysFalse @@ -12480,12 +12366,6 @@ parameters: count: 2 path: ../../../htdocs/core/tpl/extrafields_view.tpl.php - - - message: '#^Variable \$action might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../../htdocs/core/tpl/extrafields_view.tpl.php - - message: '#^Variable \$hookmanager might not be defined\.$#' identifier: variable.undefined @@ -12984,12 +12864,6 @@ parameters: count: 1 path: ../../../htdocs/debugbar/class/DataCollector/DolPhpCollector.php - - - message: '#^Parameter \#2 \$resql of method TraceableDB\:\:endTracing\(\) expects string, bool\|mysqli_result\|resource given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/debugbar/class/TraceableDB.php - - message: '#^Parameter \#1 \$callback of function spl_autoload_register expects \(callable\(string\)\: void\)\|null, Closure\(mixed\)\: bool given\.$#' identifier: argument.type @@ -13023,7 +12897,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 2 + count: 1 path: ../../../htdocs/delivery/card.php - @@ -13458,12 +13332,6 @@ parameters: count: 16 path: ../../../htdocs/emailcollector/class/emailcollector.class.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../../htdocs/emailcollector/class/emailcollector.class.php - - message: '#^Call to function method_exists\(\) with \$this\(ConferenceOrBooth\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -13839,7 +13707,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 3 + count: 1 path: ../../../htdocs/expedition/card.php - @@ -14238,12 +14106,6 @@ parameters: count: 1 path: ../../../htdocs/expensereport/card.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 10 - path: ../../../htdocs/expensereport/card.php - - message: '#^Call to function method_exists\(\) with \$this\(ExpenseReport\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -14274,12 +14136,6 @@ parameters: count: 2 path: ../../../htdocs/expensereport/class/expensereport.class.php - - - message: '#^Parameter \#2 \$pu of function calcul_price_total expects float, string given\.$#' - identifier: argument.type - count: 1 - path: ../../../htdocs/expensereport/class/expensereport.class.php - - message: '#^Property ExpenseReport\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -14571,7 +14427,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 11 + count: 1 path: ../../../htdocs/fichinter/card.php - @@ -15213,7 +15069,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 7 + count: 2 path: ../../../htdocs/fourn/commande/card.php - @@ -15381,7 +15237,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 6 + count: 1 path: ../../../htdocs/fourn/facture/card.php - @@ -15732,12 +15588,6 @@ parameters: count: 2 path: ../../../htdocs/holiday/view_log.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 2 - path: ../../../htdocs/hrm/admin/admin_hrm.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -17142,12 +16992,6 @@ parameters: count: 1 path: ../../../htdocs/main.inc.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 2 - path: ../../../htdocs/main.inc.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -17778,12 +17622,6 @@ parameters: count: 1 path: ../../../htdocs/modulebuilder/template/myobject_document.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: ../../../htdocs/modulebuilder/template/myobject_list.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -18018,12 +17856,6 @@ parameters: count: 1 path: ../../../htdocs/mrp/mo_card.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../../htdocs/mrp/mo_card.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -18108,12 +17940,6 @@ parameters: count: 2 path: ../../../htdocs/mrp/mo_production.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../../htdocs/mrp/mo_production.php - - message: '#^Unable to resolve the template type T in call to function dol_sort_array$#' identifier: argument.templateType @@ -18360,12 +18186,6 @@ parameters: count: 2 path: ../../../htdocs/partnership/class/partnershiputils.class.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 2 - path: ../../../htdocs/partnership/class/partnershiputils.class.php - - message: '#^Variable \$triggersendname in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -18396,12 +18216,6 @@ parameters: count: 1 path: ../../../htdocs/partnership/partnership_card.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 2 - path: ../../../htdocs/partnership/partnership_card.php - - message: '#^Variable \$soc might not be defined\.$#' identifier: variable.undefined @@ -19752,12 +19566,6 @@ parameters: count: 1 path: ../../../htdocs/product/stock/movement_list.php - - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' - identifier: empty.variable - count: 1 - path: ../../../htdocs/product/stock/movement_list.php - - message: '#^Variable \$socid might not be defined\.$#' identifier: variable.undefined @@ -21903,7 +21711,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 6 + count: 1 path: ../../../htdocs/reception/card.php - @@ -22230,12 +22038,6 @@ parameters: count: 1 path: ../../../htdocs/recruitment/admin/public_interface.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: ../../../htdocs/recruitment/admin/setup.php - - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue @@ -22260,12 +22062,6 @@ parameters: count: 1 path: ../../../htdocs/recruitment/admin/setup.php - - - message: '#^Empty array passed to foreach\.$#' - identifier: foreach.emptyArray - count: 1 - path: ../../../htdocs/recruitment/admin/setup_candidatures.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -23244,12 +23040,6 @@ parameters: count: 1 path: ../../../htdocs/societe/messaging.php - - - message: '#^Variable \$id might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/societe/notify/card.php - - message: '#^Call to function is_array\(\) with array\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -23481,7 +23271,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 4 + count: 1 path: ../../../htdocs/supplier_proposal/card.php - @@ -23883,7 +23673,7 @@ parameters: - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable - count: 2 + count: 1 path: ../../../htdocs/ticket/card.php - diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 01eb263d1b2..9b8f28c74aa 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -1,9 +1,9 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2009 Regis Houssin - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,8 @@ require '../../main.inc.php'; * @var HookManager $hookmanager * @var Translate $langs * @var User $user + * + * @var string $conffile */ // Load translation files required by the page @@ -54,7 +56,6 @@ llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-system_constall'); print load_fiche_titre($langs->trans("SummaryConst"), '', 'title_setup'); - print load_fiche_titre($langs->trans("ConfigurationFile").' ('.basename($conffile).')'); // Parameters in conf.php file (when a parameter start with ?, it is shown only if defined) $configfileparameters = array( diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 49ef6e2b0d1..ee831d92a19 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -3,7 +3,7 @@ * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2007-2012 Regis Houssin * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,6 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; * @var User $user * * @var string $dolibarr_main_document_root_alt + * @var string $conffile */ // Load translation files required by the page diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 39109fe9b93..e52fc4e8136 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -1,6 +1,7 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2008-2020 Laurent Destailleur + * Copyright (C) 2024 MDW + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,8 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = // By default use the TLS version decided by PHP. // You can force, if supported a version like TLSv1 or TLSv1.2 if (getDolGlobalString('MAIN_CURL_SSLVERSION')) { - curl_setopt($ch, CURLOPT_SSLVERSION, getDolGlobalString('MAIN_CURL_SSLVERSION')); + $sslversion = is_numeric(getDolGlobalString('MAIN_CURL_SSLVERSION')) ? getDolGlobalInt('MAIN_CURL_SSLVERSION') : constant(getDolGlobalString('MAIN_CURL_SSLVERSION')); + curl_setopt($ch, CURLOPT_SSLVERSION, (int) $sslversion); } //curl_setopt($ch, CURLOPT_SSLVERSION, 6); for tls 1.2