Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.5
-
Fix Version/s: 4.5
-
Component/s: CiviCRM Profile, Core CiviCRM
-
Labels:
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.