Importing contact data from CSV into checkbox custom fields fails where CSV data is not an array
Overview
When importing contacts using a CSV file, containing data intended for storage in custom fields, the import fails for any Individual where a target custom field has checkboxes, and the CSV row contains only one value to 'tick'. (nb. only the Contact Type "Individuals" has been tested)
Reproduction steps
- On Demo site, click on Contacts > Import Contacts
- First row contains column headers: yes, Contact type: Individual, For duplicate contacts: Update
- Choose Dedupe rule on Demo: ID Only
Upload a CSV file with this data:
CiviCRM ID | Answer |
---|---|
249 | Answer1,Answer2,Answer3 |
250 | Answer3 |
Current behaviour
The import of 249 will succeed. The import of 250 will fail, as it contains only one item:
Line Number | Reason | CiviCRM ID | Answer |
---|---|---|---|
2 | '1' is not a valid option for field custom_16 | 250 | Answer3 |
Expected behaviour
Both rows should import, as the data in the CSV matches the answer options for Custom_16
Environment information
Fault replicated on Drupal Demo, and on Wordpress using CiviCRM 5.58.1 Wordpress environment running PHP 7.4