mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
restore template object state on exception, free lexer/parser resources
This commit is contained in:
@@ -415,7 +415,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
Smarty_Internal_Debug::end_compile($this->template);
|
Smarty_Internal_Debug::end_compile($this->template);
|
||||||
}
|
}
|
||||||
// free memory
|
// free memory
|
||||||
unset($this->parser->lex, $this->parser->root_buffer, $this->parser->current_buffer, $this->parser);
|
$this->parser = null;
|
||||||
}
|
}
|
||||||
// restore source
|
// restore source
|
||||||
$this->template->source = $this->savedSource;
|
$this->template->source = $this->savedSource;
|
||||||
@@ -452,6 +452,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
|
$this->_tag_stack = array();
|
||||||
|
$this->_tag_objects = array();
|
||||||
// restore source
|
// restore source
|
||||||
$this->template->source = $this->savedSource;
|
$this->template->source = $this->savedSource;
|
||||||
$this->savedSource = null;
|
$this->savedSource = null;
|
||||||
@@ -459,8 +461,6 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
// free memory
|
// free memory
|
||||||
$this->parent_compiler = null;
|
$this->parent_compiler = null;
|
||||||
$this->template = null;
|
$this->template = null;
|
||||||
$this->_tag_stack = array();
|
|
||||||
$this->_tag_objects = array();
|
|
||||||
$this->parser = null;
|
$this->parser = null;
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user