From 5d1ba7ca9c7ea3298f9f91a715ec4c616424d85a Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Thu, 6 Aug 2015 19:40:37 +0200 Subject: [PATCH] restore template object state on exception, free lexer/parser resources --- libs/sysplugins/smarty_internal_templatecompilerbase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index d3863e42..76c4e7e0 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -415,7 +415,7 @@ abstract class Smarty_Internal_TemplateCompilerBase Smarty_Internal_Debug::end_compile($this->template); } // free memory - unset($this->parser->lex, $this->parser->root_buffer, $this->parser->current_buffer, $this->parser); + $this->parser = null; } // restore source $this->template->source = $this->savedSource; @@ -452,6 +452,8 @@ abstract class Smarty_Internal_TemplateCompilerBase } } catch (Exception $e) { + $this->_tag_stack = array(); + $this->_tag_objects = array(); // restore source $this->template->source = $this->savedSource; $this->savedSource = null; @@ -459,8 +461,6 @@ abstract class Smarty_Internal_TemplateCompilerBase // free memory $this->parent_compiler = null; $this->template = null; - $this->_tag_stack = array(); - $this->_tag_objects = array(); $this->parser = null; throw $e; }