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

CRM_Contact_BAO_Contact::getcontactTypes returns subtype bounded by "\x01" delimeters

    Details

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

      Description

      My profiles suddenly became unusable, displaying the message from line 429 of CRM/Profile/Form.php: "This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types."

      Debugging revealed that the contactSubType being returned from CRM_Contact_BAO_Contact::getcontactTypes had an additional character "\x01" added to the beginning and the end of the string.

      I have made the following change to my installation to work around the problem, but I'm sure the correct fix lies elsewhere:

      diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php
      index 5ab70ae..24dbbe6 100644
      — a/CRM/Contact/BAO/Contact.php
      +++ b/CRM/Contact/BAO/Contact.php
      @@ -1076,7 +1076,7 @@ WHERE id={$id}; ";
      if ($contact)

      { return array( $contact->contact_type, - $contact->contact_sub_type, + strtr($contact->contact_sub_type, array("\x01" => '')), ); }

      else {

        Attachments

          Activity

            People

            • Assignee:
              ravish.nair Ravish Nair
              Reporter:
              pillarsdotnet Bob Vincent
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: