Fatal DB Error: already exists on event registration/contribution pages when profile has user creation
Steps to replicate
- In Drupal account settings, set Who can register accounts? = Visitors and un-tick Require e-mail verification when a visitor creates an account.
- In standard Your Registration Info profile settings, set Drupal user account registration option? = Account creation required.
- Create a basic event with no fees, allowing online registration, using above profile.
- As an anonymous user, register for the event, using email address and username that do not exist in the Civi or Drupal databases.
Expected behaviour Contact created and registered for event, user created.
Actual behaviour Fatal DB Error: already exists
[debug_info] => INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES
( 1 , 5 , 'blah@blah.blah' , 207 ) [nativecode=1062 ** Duplicate entry 'blah@blah.blah' for key 'UI_uf_name_domain_id']
2 contacts created with same email address:
- first (by id) with display name = provided name, has participant record, no UF match record.
- second (by id) with display name = email, no participant record, has UF match record. User created.
Similar past issues:
- CRM-16234 User Creation via profile fails with DB Error
- CRM-19195 Duplicate entry in civicrm_uf_match when forcing account creation
Replicated on 5.9.0/Drupal 7 and current local dmaster.
On local civibuild drupal-demo 5.8.2: the contact, participant, user & UF match records were created successfully.