From debed2ab5060f4e782ce1e410b30adf0a4963064 Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Thu, 9 Dec 2021 13:53:19 -0500 Subject: [PATCH] fix infinite loop on Civi 5.44+ --- reltoken.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reltoken.php b/reltoken.php index dfc0d64..dc0ee04 100644 --- a/reltoken.php +++ b/reltoken.php @@ -6,9 +6,14 @@ * implementation of CiviCRM hook */ function reltoken_civicrm_tokens(&$tokens) { + static $calledOnce = FALSE; // Get a list of the standard contact tokens. // Note that CRM_Core_SelectValues::contactTokens() will invoke this hook again. - $contactTokens = CRM_Core_SelectValues::contactTokens(); + $contactTokens = []; + if (!$calledOnce) { + $calledOnce = TRUE; + $contactTokens = CRM_Core_SelectValues::contactTokens(); + } $hashedRelationshipTypes = _reltoken_get_hashed_relationship_types(); // For each standard contact token, create a corresponding token for each