PHP 8.0: Avoid fatal error "array_key_exists(): Argument #2 ($array) must be of type array, null given"

This commit is contained in:
nathan 2021-10-13 09:55:51 -06:00
parent 65b0a31aeb
commit f8fd87cd1d

View File

@ -183,18 +183,27 @@ class importexport_wizard_basic_export_csv
$content['step'] = 'wizard_step40';
// If editing an existing definition, these will be in plugin_options
if(!$content['delimiter'] && $content['plugin_options']['delimiter']) {
if(!$content['delimiter'] && $content['plugin_options']['delimiter'])
{
$content['delimiter'] = $content['plugin_options']['delimiter'];
} elseif (!$content['delimiter']) {
}
elseif(!$content['delimiter'])
{
$content['delimiter'] = ';';
}
if(!$content['charset'] && $content['plugin_options']['charset']) {
if(!$content['charset'] && $content['plugin_options']['charset'])
{
$content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user';
}
if(!array_key_exists('begin_with_fieldnames', $content) && array_key_exists('begin_with_fieldnames', $content['plugin_options'])) {
if(!array_key_exists('begin_with_fieldnames', $content) &&
is_array($content['plugin_options']) &&
array_key_exists('begin_with_fieldnames', $content['plugin_options']))
{
$content['begin_with_fieldnames'] = $content['plugin_options']['begin_with_fieldnames'];
}
if(!array_key_exists('convert', $content) && array_key_exists('convert', $content['plugin_options'])) {
if(!array_key_exists('convert', $content) &&
is_array($content['plugin_options']) && array_key_exists('convert', $content['plugin_options']))
{
$content['convert'] = $content['plugin_options']['convert'];
}
@ -204,7 +213,7 @@ class importexport_wizard_basic_export_csv
1 => lang('Field names'),
'label' => lang('Field labels')
);
$sel_options['charset'] = Api\Translation::get_installed_charsets()+
$sel_options['charset'] = Api\Translation::get_installed_charsets() +
array(
'user' => lang('User preference'),
);