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

Updating an existing contact and setting prefix to an empty string results in error at CRM/Utils/Array.php on line 54

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 3.0.2
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      Updating an existing contact and setting prefix to an empty string results in the following error:

      Warning: array_key_exists(): The first argument should be either a string or an integer in /home/tom/workspace/example/sites/example.com/modules/civicrm/CRM/Utils/Array.php on line 54

      The following script is a test that I ran from my civicrm bin directory as a test (thanks dlobo):

      <?php

      require_once '../../../civicrm.settings.php';
      require_once '../CRM/Core/Config.php';
      require_once '../CRM/Core/Error.php';
      $config = CRM_Core_Config::singleton( );

      require_once 'api/v2/Contact.php';
      $params = array(
      'contact_id' => '17911',
      'contact_type' => 'Individual',
      'external_identifier' => '58534',
      'prefix' => '',
      'first_name' => 'Tom KP',
      'last_name' => 'Mansfield',
      'gender_id' => '',
      'organization_name' => '',
      'addressee_custom' => 'Tom',
      );
      $result = civicrm_contact_add( $params );
      CRM_Core_Error::debug( $result );
      ?>

      The contact does appear to update successfully.
      Commenting out the line 'prefix' => '' makes the error go away.

        Attachments

          Activity

            People

            • Assignee:
              sushant Sushant Paste
              Reporter:
              mrfelton Tom Kirkpatrick
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: