From 42e722926a0c7bc962093686cbffdc85d9906213 Mon Sep 17 00:00:00 2001 From: uwetews Date: Sun, 25 Oct 2015 04:53:58 +0100 Subject: [PATCH] - bugfix Error when using {include} within {capture} https://github.com/smarty-php/smarty/issues/100 --- libs/sysplugins/smarty_template_resource_base.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/sysplugins/smarty_template_resource_base.php b/libs/sysplugins/smarty_template_resource_base.php index 2f7ef194..b9e2e283 100644 --- a/libs/sysplugins/smarty_template_resource_base.php +++ b/libs/sysplugins/smarty_template_resource_base.php @@ -122,9 +122,13 @@ abstract class Smarty_Template_Resource_Base // // render compiled or saved template code // + if (!isset($_template->_cache['capture_stack'])) { + $_template->_cache['capture_stack'] = array(); + } + $_saved_capture_level = count($_template->_cache['capture_stack']); $unifunc($_template); // any unclosed {capture} tags ? - if (isset($_template->_cache['capture_stack'][0])) { + if ($_saved_capture_level != count($_template->_cache['capture_stack'])) { $_template->capture_error(); } if (isset($_template->smarty->security_policy)) {