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

validateSubTypeByEntity checks value instead of key (Fatal error after 4.7.7 upgrade)

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Critical
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.16, 4.7.7
    • Fix Version/s: 4.6.17, 4.7.8
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      We're experiencing an issue after updating to 4.7.7

      We're hitting a fatal error in the method CRM_Core_BAO_CustomGroup::validateSubTypeByEntity
      https://github.com/civicrm/civicrm-core/blob/6b85570b47e529d1d728e972ece3b95d9330009b/CRM/Core/BAO/CustomGroup.php#L655

      This function is looking for the entity type in an array:
      if ($entityType != 'Contact' && !in_array($entityType, $contactTypes['values'])) {

      as a value when it should be looking for the key.

      In our case we have 'Organisation' not 'Organization' so the array looks like:

      Organization => Organisation

      So in_array isn't working.

      PR forthcoming to use array_key_exists instead

        Attachments

          Activity

            People

            • Assignee:
              yashodha Yashodha Chaku
              Reporter:
              john John K.
            • Votes:
              2 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m