Skip to content

Commit

Permalink
Move unset into the else condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker authored Jan 28, 2017
1 parent 64701ef commit 796a057
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libraries/cms/application/site.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ public function getTemplate($params = false)
$template->params = new Registry($template->params);
}

// Unset the $template reference to the last $templates[n] item cycled in the foreach above to avoid editing it later
unset($template);

// Add home element, after loop to avoid double execution
if (isset($template_home))
{
Expand All @@ -507,8 +510,6 @@ public function getTemplate($params = false)
$cache->store($templates, $cacheId);
}

// Unset the $template reference to the last $templates[n] item cycled in the foreach above to avoid to edit the $templates array in the following assignment
unset($template);
if (isset($templates[$id]))
{
$template = $templates[$id];
Expand Down

0 comments on commit 796a057

Please sign in to comment.