mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
Return to saved output buffer level on exceptions
This commit is contained in:
@@ -335,6 +335,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
public function getRenderedTemplateCode()
|
public function getRenderedTemplateCode()
|
||||||
{
|
{
|
||||||
|
$level = ob_get_level();
|
||||||
try {
|
try {
|
||||||
ob_start();
|
ob_start();
|
||||||
if (empty($this->properties['unifunc']) || !is_callable($this->properties['unifunc'])) {
|
if (empty($this->properties['unifunc']) || !is_callable($this->properties['unifunc'])) {
|
||||||
@@ -359,7 +360,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
|||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
ob_get_clean();
|
while (ob_get_level() > $level) {
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -56,13 +56,16 @@ abstract class Smarty_Resource_Uncompiled extends Smarty_Resource
|
|||||||
*/
|
*/
|
||||||
public function render($_template)
|
public function render($_template)
|
||||||
{
|
{
|
||||||
try {
|
$level = ob_get_level();
|
||||||
ob_start();
|
ob_start();
|
||||||
|
try {
|
||||||
$this->renderUncompiled($_template->source, $_template);
|
$this->renderUncompiled($_template->source, $_template);
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
ob_get_clean();
|
while (ob_get_level() > $level) {
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -149,12 +149,15 @@ class Smarty_Template_Compiled
|
|||||||
$compileCheck = $_template->smarty->compile_check;
|
$compileCheck = $_template->smarty->compile_check;
|
||||||
$_template->smarty->compile_check = false;
|
$_template->smarty->compile_check = false;
|
||||||
if ($_template->source->recompiled) {
|
if ($_template->source->recompiled) {
|
||||||
try {
|
$level = ob_get_level();
|
||||||
ob_start();
|
ob_start();
|
||||||
|
try {
|
||||||
eval("?>" . $this->code);
|
eval("?>" . $this->code);
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
ob_get_clean();
|
while (ob_get_level() > $level) {
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
ob_get_clean();
|
ob_get_clean();
|
||||||
|
@@ -219,13 +219,16 @@ class Smarty_Template_Source
|
|||||||
*/
|
*/
|
||||||
public function renderUncompiled(Smarty_Internal_Template $_template)
|
public function renderUncompiled(Smarty_Internal_Template $_template)
|
||||||
{
|
{
|
||||||
try {
|
$level = ob_get_level();
|
||||||
ob_start();
|
ob_start();
|
||||||
|
try {
|
||||||
$this->handler->renderUncompiled($_template->source, $_template);
|
$this->handler->renderUncompiled($_template->source, $_template);
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
ob_get_clean();
|
while (ob_get_level() > $level) {
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user