(Regression) - Users are unable to register via /user/register forms anymore
If the user registration profile has a checkbox custom field then the system throws error with '' is not a valid option for field custom_118
Steps to replicate
- Add checkbox custom field(with atleast 3 options) of extending Contact and include it in a profile
- Set the profile to use for user registration
- visit /user/register page, enter the details, check the boxes(leave one unchecked). Submit the form
Expected result:
User account should be created and Information should be saved in Civi
Actual result:
Error with a message in watchdog
CRM_Core_Exception: '' is not a valid option for field custom_118 in civicrm_api3() (line 135 of /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/api/api.php).
Bactrace:
Apr 14 13:34:56 [debug] $$apiResponse = #0 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/api/v3/utils.php(2421): CRM_Core_Error::backtrace("$apiResponse", 1)
#1 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/api/v3/utils.php(2349): _civicrm_api3_api_match_pseudoconstant_value("", (Array:4), "custom_118", NULL)
#2 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/api/v3/utils.php(2281): _civicrm_api3_api_match_pseudoconstant((Array:4), "Contact", "custom_118", (Array:31), NULL)
#3 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/api/v3/utils.php(1633): _civicrm_api3_validate_string((Array:22), "custom_118", (Array:31), "Contact", "create")
#4 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/Civi/API/Subscriber/APIv3SchemaAdapter.php(76): _civicrm_api3_validate_fields("Contact", "create", (Array:22), (Array:5))
#5 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Civi\API\Subscriber\APIv3SchemaAdapter->onApiPrepare_validate(Object(Civi\API\Event\PrepareEvent), "civi.api.prepare", Object(Civi\Core\CiviEventDispatcher))
#6 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:9), "civi.api.prepare", Object(Civi\API\Event\PrepareEvent))
#7 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners((Array:9), "civi.api.prepare", Object(Civi\API\Event\PrepareEvent))
#8 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(217): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Civi\API\Event\PrepareEvent), Object(Civi\API\Event\PrepareEvent))
#9 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/Civi/API/Kernel.php(240): Civi\Core\CiviEventDispatcher->dispatch("civi.api.prepare", Object(Civi\API\Event\PrepareEvent))
#10 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/Civi/API/Kernel.php(148): Civi\API\Kernel->prepare(Object(Civi\API\Provider\MagicFunctionProvider), (Array:8))
#11 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/Civi/API/Kernel.php(81): Civi\API\Kernel->runRequest((Array:8))
#12 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/api/api.php(133): Civi\API\Kernel->runSafe("Contact", "create", (Array:21))
#13 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/CRM/Core/BAO/UFMatch.php(278): civicrm_api3("Contact", "create", (Array:21))
#14 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/CRM/Core/BAO/UFMatch.php(104): CRM_Core_BAO_UFMatch::synchronizeUFMatch(Object(stdClass), "21", "pradeep+ytrt@circle-interactive.co.ukddd", "Drupal", NULL, "Individual", FALSE)
#15 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/drupal/civicrm.module(547): CRM_Core_BAO_UFMatch::synchronize(Object(stdClass), TRUE, "Drupal", "Individual")
#16 /Library/WebServer/Documents/drupal7/sites/all/modules/civicrm/drupal/civicrm_user.inc(70): civicrm_register_data((Array:24), Object(stdClass), "account", FALSE)
#17 /Library/WebServer/Documents/drupal7/modules/user/user.module(101): civicrm_user_insert((Array:24), Object(stdClass), "account")
#18 /Library/WebServer/Documents/drupal7/modules/user/user.module(596): user_module_invoke("insert", (Array:24), Object(stdClass), "account")
#19 /Library/WebServer/Documents/drupal7/modules/user/user.module(3945): user_save(Object(stdClass), (Array:24))
#20 /Library/WebServer/Documents/drupal7/includes/form.inc(1531): user_register_submit((Array:36), (Array:21))
#21 /Library/WebServer/Documents/drupal7/includes/form.inc(906): form_execute_handlers("submit", (Array:36), (Array:21))
#22 /Library/WebServer/Documents/drupal7/includes/form.inc(386): drupal_process_form("user_register_form", (Array:36), (Array:21))
#23 /Library/WebServer/Documents/drupal7/includes/form.inc(131): drupal_build_form("user_register_form", (Array:21))
#24 /Library/WebServer/Documents/drupal7/includes/menu.inc(527): drupal_get_form("user_register_form")
#25 /Library/WebServer/Documents/drupal7/index.php(21): menu_execute_active_handler()
Api params passed
Array
(
[name] => testssddd
[mail] => pradeep+ytrt@test.com
[timezone] => Europe/London
[form_build_id] => form-itTfOP_PU7O_GmrjvPKtXXypybV7isjhUspFtqRfeS0
[form_id] => user_register_form
[MAX_FILE_SIZE] => 2097152
[edit] => Array
(
[civicrm_dummy_field] => CiviCRM Dummy Field for Drupal
)
[gid] =>
[first_name] => Pradeep
[last_name] => Nayak
[street_address-1] =>
[city-1] =>
[postal_code-1] =>
[country-1] =>
[state_province-1] =>
[custom_118] => Array
(
[1] =>
[2] => 1
[3] => 1
[4] =>
)
[op] => Create new account
[_qf_default] => Dynamic:upload
[email] => pradeep+ytrt@test.com
[contact_type] => Individual
[version] => 3
)