Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-9091

Fatal error occurs when account registration matches a contact with an existing account

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: 3.3.6, 3.4.alpha, 3.4.beta, 3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.4.5, 3.4.6, 3.4.7, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.6, 4.0.7
    • Fix Version/s: Unscheduled
    • Component/s: Core CiviCRM
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      We have identified this issue in 3.3.5 and the current drupal demo site.

      The general problem is - if when creating a drupal registration, the registration information provided matches a contact record that already has an associated drupal account, a fatal DB error occurs.
      .
      I'm guessing this is a primary key violation on contact id since none of the drupal account validations fail (email, username).

      I reproduced this on the current demo site as follows

      1 - find a contact with 2 email addresses
      2 - register using the first email address - verify that account is linked to contact
      3 - register using the second email address
      4 - error occurs

      Here is the error I received

      Database Error Code: Duplicate entry '27-1' for key 3, 1062
      Additional Details:

      Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => -5
      [message] => DB Error: already exists
      [mode] => 16
      [debug_info] => INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 , 47 , 'adamssam@indiatimes.co.pl' , 27 ) [nativecode=1062 ** Duplicate entry '27-1' for key 3]
      [type] => DB_Error
      [user_info] => INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 , 47 , 'adamssam@indiatimes.co.pl' , 27 ) [nativecode=1062 ** Duplicate entry '27-1' for key 3]
      [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_uf_match (domain_id , uf_id , uf_name , contact_id ) VALUES ( 1 , 47 , 'adamssam@indiatimes.co.pl' , 27 ) [nativecode=1062 ** Duplicate entry '27-1' for key 3]"]
      )

      Here is the backtrace
      /var/www/drupal.civicrm.org/svn/civicrm34/CRM/Core/Error.php, backtrace, 159
      , handle,
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/PEAR.php, call_user_func, 931
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/DB.php, PEAR_Error, 968
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/PEAR.php, DB_Error, 564
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/DB/common.php, raiseError, 1903
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/DB/mysql.php, raiseError, 898
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/DB/mysql.php, mysqlRaiseError, 327
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/DB/common.php, simpleQuery, 1216
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/DB/DataObject.php, query, 2424
      /var/www/drupal.civicrm.org/svn/civicrm34/packages/DB/DataObject.php, _query, 1054
      /var/www/drupal.civicrm.org/svn/civicrm34/CRM/Core/DAO.php, insert, 288
      /var/www/drupal.civicrm.org/svn/civicrm34/CRM/Core/BAO/UFMatch.php, save, 194
      /var/www/drupal.civicrm.org/svn/civicrm34/drupal/civicrm.module, synchronize, 541
      /var/www/drupal.civicrm.org/svn/civicrm34/drupal/civicrm.module, civicrm_register_data, 402
      /var/www/drupal.civicrm.org/public/modules/user/user.module, civicrm_user, 21
      /var/www/drupal.civicrm.org/public/modules/user/user.module, user_module_invoke, 339
      /var/www/drupal.civicrm.org/public/modules/user/user.module, user_save, 2360
      /var/www/drupal.civicrm.org/public/includes/form.inc, user_register_submit, 781
      /var/www/drupal.civicrm.org/public/includes/form.inc, form_execute_handlers, 421
      /var/www/drupal.civicrm.org/public/includes/form.inc, drupal_process_form, 120
      , drupal_get_form,
      /var/www/drupal.civicrm.org/public/includes/menu.inc, call_user_func_array, 349
      /var/www/drupal.civicrm.org/public/index.php, menu_execute_active_handler, 17

      We are seeing this issue with clients that have contacts will multiple emails. The individual generally has a personal email and an organization related email.
      They often forget they have an existing account or can't follow the password reset process. So when they try and recreate the account with the first email and it failed because it is duplicate they then go and register again using their secondary email.

      It seems that there are few options for handling this

      1 - change the database constraint to allow the 2 account to be linked to the contact (there is probably some downside to this but none immediately come to mind)
      2 - display a message that this is a duplicate account and provide a link to request a password reset and somehow pre-pop the original email associated with the account)

      The only issue I see with option 2 is that we see a lot of environments where site use is sporadic (only once or twice a year) if the original email on the account is no longer valid there is no way for the user to correct it, so creating a second account is the only solution.

      I think sim

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dschafer Dave Schafer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: