From e7f70535d30728e0a26c0da7620874fa69a7ee88 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 20 Mar 2021 08:29:30 +1100 Subject: [PATCH] [REF] Fix APIv3 MembershipJob test failure on php7.4 by only doing checking if it is not empty --- api/v3/Membership.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/v3/Membership.php b/api/v3/Membership.php index 6232fd2028..c7a3b1d5e4 100644 --- a/api/v3/Membership.php +++ b/api/v3/Membership.php @@ -281,12 +281,14 @@ function _civicrm_api3_membership_relationsship_get_customv2behaviour(&$params, $relationships = []; foreach ($membershipValues as $membershipId => $values) { // populate the membership type name for the membership type id - $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($values['membership_type_id']); + $membershipType = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($values['membership_type_id']) ?? []; - $membershipValues[$membershipId]['membership_name'] = $membershipType['name']; + if (!empty($membershipType)) { + $membershipValues[$membershipId]['membership_name'] = $membershipType['name']; - if (!empty($membershipType['relationship_type_id'])) { - $relationships[$membershipType['relationship_type_id']] = $membershipId; + if (!empty($membershipType['relationship_type_id'])) { + $relationships[$membershipType['relationship_type_id']] = $membershipId; + } } // populating relationship type name. -- 2.25.1