From 0eddd0faacaec212016e282d95b1f4e71f0d5fb6 Mon Sep 17 00:00:00 2001 From: Jim Graham Date: Wed, 27 Sep 2023 14:00:19 -0400 Subject: [PATCH] Fix undefined variable error in modTemplateVar (#16427) Move $policyTable variable up in scope to avoid error that occurs when $rgEnabled (~L993) is false and $catEnabled (~L1019) is true. Co-authored-by: Jim Graham --- core/model/modx/modtemplatevar.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/model/modx/modtemplatevar.class.php b/core/model/modx/modtemplatevar.class.php index 0c8d3fee5c4..f68a1da29f0 100644 --- a/core/model/modx/modtemplatevar.class.php +++ b/core/model/modx/modtemplatevar.class.php @@ -990,9 +990,9 @@ public function findPolicy($context = '') { $enabled = ($catEnabled || $rgEnabled); if ($enabled) { if (empty($this->_policies) || !isset($this->_policies[$context])) { + $policyTable = $this->xpdo->getTableName('modAccessPolicy'); if ($rgEnabled) { $accessTable = $this->xpdo->getTableName('modAccessResourceGroup'); - $policyTable = $this->xpdo->getTableName('modAccessPolicy'); $resourceGroupTable = $this->xpdo->getTableName('modTemplateVarResourceGroup'); $sql = "SELECT Acl.target, Acl.principal, Acl.authority, Acl.policy, Policy.data FROM {$accessTable} Acl " . "LEFT JOIN {$policyTable} Policy ON Policy.id = Acl.policy " .