CRM-21849: Change to loose comparison
authorMichael Devery <michael@compucorp.co.uk>
Tue, 27 Mar 2018 13:43:56 +0000 (14:43 +0100)
committerMichael Devery <michael@compucorp.co.uk>
Mon, 16 Apr 2018 12:45:59 +0000 (13:45 +0100)
Based on the docblock I expected contact ID to be an int, but this is
not always the case.

CRM/Contact/BAO/Relationship.php

index 2b4cd47e7cc6f6ed4626d880906409b789754298..afad1081028b6b145b58a2f08d38160a0dea4632 100644 (file)
@@ -539,7 +539,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
       $relationship->id = $relationshipId;
       if ($relationship->find(TRUE)) {
         $contact = new CRM_Contact_DAO_Contact();
-        $contact->id = ((int) $relationship->contact_id_a === $contactId) ? $relationship->contact_id_b : $relationship->contact_id_a;
+        $contact->id = ($relationship->contact_id_a == $contactId) ? $relationship->contact_id_b : $relationship->contact_id_a;
 
         if ($contact->find(TRUE)) {
           $otherContactType = $contact->contact_type;