fix PHP 8.0 error: count(): Argument #1 ($value) must be of type Countable|array, string given

This commit is contained in:
Ralf Becker 2021-10-19 09:03:13 +02:00
parent 1fd6a1f4aa
commit 937a96198c

View File

@ -358,7 +358,7 @@ class importexport_import_csv implements importexport_iface_import_record { //,
if ($record[$name]) { if ($record[$name]) {
// Automatically handle text owner without explicit translation // Automatically handle text owner without explicit translation
$new_owner = importexport_helper_functions::account_name2id($record[$name]); $new_owner = importexport_helper_functions::account_name2id($record[$name]);
if(count($new_owner) != count(explode(',',$record[$name]))) if(!is_array($new_owner) || count($new_owner) != count(explode(',', $record[$name])))
{ {
// Unable to parse value into account // Unable to parse value into account
$warnings[] = $name . ': ' .lang('%1 is not a known user or group', $record[$name]); $warnings[] = $name . ': ' .lang('%1 is not a known user or group', $record[$name]);