mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-18 14:33:49 +01:00
LStemplate: detect and stop template displaying loop
This commit is contained in:
parent
c9b2341dbf
commit
06071f2f5f
1 changed files with 9 additions and 0 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue