From 58fe06e14decb3e9e934bdfb7a9b495d91d44f45 Mon Sep 17 00:00:00 2001 From: colemanw Date: Tue, 12 Sep 2023 12:30:01 -0400 Subject: [PATCH] DAO - Prevent recursion adding acl clause to entity that references itself --- CRM/Core/DAO.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 3faae6f723..b980479fcb 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -3097,7 +3097,8 @@ SELECT contact_id $relatedClauses = []; $relatedEntities = static::buildOptions('entity_table', 'get'); foreach ((array) $relatedEntities as $table => $ent) { - if (!empty($ent)) { + // Prevent recursion + if (!empty($ent) && $table !== static::getTableName()) { $ent = CRM_Core_DAO_AllCoreTables::getEntityNameForTable($table); $subquery = CRM_Utils_SQL::mergeSubquery($ent); if ($subquery) { -- 2.25.1