diff --git a/libraries/cms/application/site.php b/libraries/cms/application/site.php index daf33a2ce734c..d5e66bf07066a 100644 --- a/libraries/cms/application/site.php +++ b/libraries/cms/application/site.php @@ -507,6 +507,8 @@ 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];