PHP Warnings when 'name' of relationship types are duplicated
This is a tenuous edge-case, but:
Steps to recreate:
- Administer relationship types: https://dmaster.demo.civicrm.org/civicrm/admin/reltype?reset=1
- Add a new relationship type
- Enter 'Foo of' for both a-b and b-a labels, save
- Edit the relationship, change the label for a-b to 'Foo not of'
- Save
- View a contact record, flush caches:
Warning: array_combine(): Both parameters should have an equal number of elements in CRM_Contact_BAO_Relationship::buildRelationshipTypeOptions() (line 2239 of .../civicrm/CRM/Contact/BAO/Relationship.php).
This is because the removeRelationshipTypeDuplicates method is removing the duplicate 'names' but not the duplicate 'labels', which creates an imbalance for the array_combine()
I'm pretty confused about why these methods are going to so much trouble to build and dedupe and list of relationship types anyway?
But the issue is, this means that CRM_Contact_BAO_Relationship::buildRelationshipTypeOptions() actually returns FALSE, when we're not on a form, because it couldn't combine the array. I haven't seen where this is causing a breakage yet, but it gives me the heebie-jeebies.
Related to https://github.com/civicrm/civicrm-core/pull/11853