diff --git a/src/includes/class/class.LStemplate.php b/src/includes/class/class.LStemplate.php index c77732be..cb8d0a01 100644 --- a/src/includes/class/class.LStemplate.php +++ b/src/includes/class/class.LStemplate.php @@ -90,6 +90,9 @@ class LStemplate extends LSlog_staticLoggerClass { 'top.tpl', 'bottom.tpl', ); + // Keep trace of last displayed template (for loop detection) + private static $last_displayed_template = null; + /** * Start LStemplate * @@ -419,6 +422,12 @@ class LStemplate extends LSlog_staticLoggerClass { // Trigger displaying event self :: fireEvent('displaying'); + // Handle loop detection + if (self :: $last_displayed_template == $template) { + self :: log_error("display($template): loop detected, stop"); + return; + } + try { self :: assignCommonVars(); self :: $_smarty -> display("ls:$template");