From ccf5ff23bb5679c6b44c5f17e32d7838e1ed25d5 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 24 May 2022 12:12:24 +1200 Subject: [PATCH] Cleanup array explosion --- CRM/Contact/Import/Parser/Contact.php | 2 +- CRM/Import/Parser.php | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/CRM/Contact/Import/Parser/Contact.php b/CRM/Contact/Import/Parser/Contact.php index 6d77a380cc..72e5d405c6 100644 --- a/CRM/Contact/Import/Parser/Contact.php +++ b/CRM/Contact/Import/Parser/Contact.php @@ -280,7 +280,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Import_Parser { } $params = $this->getMappedRow($values); - $formatted = array_filter(array_intersect_key($params, array_fill_keys($this->metadataHandledFields, 1))); + $formatted = array_filter(array_intersect_key($params, array_fill_keys($this->metadataHandledFields, 1)), 'strlen'); $contactFields = CRM_Contact_DAO_Contact::import(); diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index 2c0d35be4f..415644dba5 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -1334,14 +1334,9 @@ abstract class CRM_Import_Parser { // check for values for custom fields for checkboxes and multiselect if ($isSerialized && $dataType != 'ContactReference') { - $value = trim($value); - $value = str_replace('|', ',', $value); - $mulValues = explode(',', $value); + $mulValues = array_filter(explode(',', str_replace('|', ',', trim($value))), 'strlen'); $customOption = CRM_Core_BAO_CustomOption::getCustomOption($customFieldID, TRUE); foreach ($mulValues as $v1) { - if (strlen($v1) == 0) { - continue; - } $flag = FALSE; foreach ($customOption as $v2) { -- 2.25.1