Skip to content

Commit

Permalink
Fix undefined variable error in modTemplateVar (#16427)
Browse files Browse the repository at this point in the history
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 <info@sparkmediagroup.com>
  • Loading branch information
smg6511 and Jim Graham authored Sep 27, 2023
1 parent c9269f7 commit 0eddd0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/model/modx/modtemplatevar.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 " .
Expand Down

0 comments on commit 0eddd0f

Please sign in to comment.