CRM-15527 tests indicate ['membership'] is likely to be an array at this stage
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 27 Oct 2014 02:38:11 +0000 (15:38 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 27 Oct 2014 02:38:11 +0000 (15:38 +1300)
CRM/Contribute/BAO/Contribution.php

index 268187dd22dcebeb0bd71dcf07933bd93f6a41c2..63c501a683efef982e150b2af9e5dcd01c3645cb 100644 (file)
@@ -2136,9 +2136,13 @@ WHERE  contribution_id = %1 ";
         $entity = 'contribution';
         $entityID = $ids['contribution'];
       }
-      if (isset($ids['membership']) && $ids['membership']) {
+      if (!empty($ids['membership'])) {
+        //not sure whether is is possible for this not to be an array - load related contacts loads an array but this code was expecting a string
+        // the addition of the casting is in case it could get here & be a string. Added in 4.6 - maybe remove later? This AuthorizeNetIPN & PaypalIPN tests hit this
+        // line having loaded an array
+        $ids['membership'] = (array) $ids['membership'];
         $entity = 'membership';
-        $entityID = $ids['membership'];
+        $entityID = $ids['membership'][0];
       }
 
       $url = $paymentObject->subscriptionURL($entityID, $entity);