Fix: Cope with undevined country key in search array. (#31354)

# Fix: Cope with undefined country key in search array

Fix:
```
htdocs\partnership\partnership_list.php:533 PhanUndeclaredProperty Reference to undeclared property \Partnership->login
htdocs\partnership\partnership_list.php:793 PhanTypeMismatchArgumentProbablyReal Argument 4 ($filter) is null of type null but \FormAdmin::select_language() takes array|string[] (no real type) defined at htdocs\core\class\html.formadmin.class.php:74 (the inferred real argument type has nothing in common with the parameter's phpdoc type)
```
This commit is contained in:
MDW 2024-10-11 16:04:46 +02:00 committed by GitHub
parent 9bece8c380
commit 9c20e93860
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -700,7 +700,7 @@ return [
'htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/partnership/lib/partnership.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/partnership/partnership_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/partnership/partnership_list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/partnership/partnership_list.php' => ['PhanUndeclaredProperty'],
'htdocs/paypal/lib/paypal.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/printing/index.php' => ['PhanUndeclaredProperty'],
'htdocs/printing/lib/printing.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 NextGestion <contact@nextgestion.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -790,9 +791,9 @@ foreach ($all_fields_list as $key => $val) {
} elseif ($key == 'lang') {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2);
print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2);
} elseif ($key == 'country') {
print $form->select_country($search[$key], 'search_country', '', 0, 'minwidth100imp maxwidth100');
print $form->select_country(in_array($key, $search) ? $search[$key] : 0, 'search_country', '', 0, 'minwidth100imp maxwidth100');
} else {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
}