From 41684818d939ce8d935b414b6e335a5fbf560428 Mon Sep 17 00:00:00 2001 From: uwetews Date: Wed, 27 Jan 2016 05:18:29 +0100 Subject: [PATCH] - bugfix {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153 --- change_log.txt | 1 + libs/Smarty.class.php | 2 +- libs/sysplugins/smarty_internal_compile_capture.php | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/change_log.txt b/change_log.txt index 4cc246c06..3dd87aa97 100644 --- a/change_log.txt +++ b/change_log.txt @@ -7,6 +7,7 @@ - bugfix output filters did not observe nocache code flhttps://github.com/smarty-php/smarty/issues/154g https://github.com/smarty-php/smarty/issues/160 - bugfix {extends} with relative file path did not work https://github.com/smarty-php/smarty/issues/154 https://github.com/smarty-php/smarty/issues/158 + - bugfix {capture} data could not been seen in other templates with {$smarty.capture.name} https://github.com/smarty-php/smarty/issues/153 26.01.2016 - improvement observe Smarty::$_CHARSET in debugging console https://github.com/smarty-php/smarty/issues/169 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 4e9d9ec31..e34e05310 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.30-dev/24'; + const SMARTY_VERSION = '3.1.30-dev/25'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_compile_capture.php b/libs/sysplugins/smarty_internal_compile_capture.php index be45f3e94..016f2cf11 100644 --- a/libs/sysplugins/smarty_internal_compile_capture.php +++ b/libs/sysplugins/smarty_internal_compile_capture.php @@ -52,7 +52,7 @@ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) $compiler->_capture_stack[0][] = array($buffer, $assign, $append, $compiler->nocache); // maybe nocache because of nocache variables $compiler->nocache = $compiler->nocache | $compiler->tag_nocache; - $_output = "_cache['capture_stack'][] = array($buffer, $assign, $append); ob_start(); ?>"; + $_output = "smarty->_cache['capture_stack'][] = array($buffer, $assign, $append); ob_start(); ?>"; return $_output; } @@ -74,7 +74,7 @@ public static function compileSpecialVariable($args, Smarty_Internal_TemplateCom if (!$name) { $compiler->trigger_template_error("missing or illegal \$smarty.{$tag} name attribute", null, true); } - return "(isset(\$_smarty_tpl->_cache['__smarty_capture']['{$name}']) ? \$_smarty_tpl->_cache['__smarty_capture']['{$name}'] : null)"; + return "(isset(\$_smarty_tpl->smarty->_cache['__smarty_capture']['{$name}']) ? \$_smarty_tpl->smarty->_cache['__smarty_capture']['{$name}'] : null)"; } } @@ -105,11 +105,11 @@ public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler) list($buffer, $assign, $append, $compiler->nocache) = array_pop($compiler->_capture_stack[0]); - $_output = "_cache['capture_stack']);\n"; + $_output = "smarty->_cache['capture_stack']);\n"; $_output .= "if (!empty(\$_capture_buffer)) {\n"; $_output .= " if (isset(\$_capture_assign)) \$_smarty_tpl->assign(\$_capture_assign, ob_get_contents());\n"; $_output .= " if (isset( \$_capture_append)) \$_smarty_tpl->append( \$_capture_append, ob_get_contents());\n"; - $_output .= "\$_smarty_tpl->_cache['__smarty_capture'][\$_capture_buffer]=ob_get_clean();\n"; + $_output .= "\$_smarty_tpl->smarty->_cache['__smarty_capture'][\$_capture_buffer]=ob_get_clean();\n"; $_output .= "} else \$_smarty_tpl->capture_error();?>"; return $_output;