Profile with checkbox custom field fails
Overview
Using profile form generates error message.
Reproduction steps
- Administer->Custom Data and Screens->Custom Fields
- Add Set of Custom Fields: Name = Test, Used For = Contacts, Save
- Field Label = Test, Data and Input Field Type = Alphanumeric Checkbox, Test 1, Test 2, Save
- Administer->Custom Data and Screens->Profiles
- Add Profile: Profile Name = Test, Public Title = Test, Used For = Standalone Form or Directory, Save
- Field Name = Contacts Test :: Test, Save
- Administer->Custom Data and Screens->Profiles Test More->Use - Create Mode
Current behaviour
Warning: in_array() expects parameter 2 to be array, null given in CRM_Core_BAO_CustomField::setProfileDefaults() (line 1241 of /var/www/mcce_www/public/sites/all/modules/civicrm/CRM/Core/BAO/CustomField.php).
Expected behaviour
No error message.
Environment information
- __Browser: Chrome 84.0.4147.89
- __CiviCRM: Master/5.26.2
- __PHP: 7.3
- __CMS: Drupal 7.72
- __Database: MariaDB 10.3.22
- __Web Server: Apache 2.4
Comments
Line 1239 used to use PHP explode and it was changed to CRM_Utils_Array::explodePadded. I don't think PHP explode ever returned NULL, but CRM_Utils_Array::explodePadded does return NULL, which is the problem.