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

Profile field with empty label causes error on Drupal user page

    Details

      Description

      If a profile field's label is set to empty then an error will be generated when the profile is viewed.

      To reproduce this error, edit one of the fields in the "Name and Address" profile and set the label to empty. Then visit www.yoursite.com/civicrm/profile/view?gid=1&reset=1 or your Drupal user page (www.yoursite.com/user). You should see an error message like "Undefined index: in CRM_Profile_Page_Dynamic->run()". In some cases the field values will not be displayed correctly.

      Here's what's happening: CRM_Profile_Page_Dynamic::run() is the function that displays the profile. It calls CRM_Core_BAO_UFGroup::getValues to create a $values array containing the field values. Then it creates a $labels array containing the field labels. It expects the indexes of these two arrays to match up. However, there is a mismatch in the code that generates the indexes for these arrays: the indexes are based on the labels and the two functions handle empty labels differently. So if one or more labels are empty, the indexes won't match and an error will result.

      NB: It is useful to be able to set empty labels in profiles sometimes, e.g. for the supplemental address fields.

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              kirk Kirk Jackson
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: