From 6719bc5c41976961bbea8d1c0e7a0a5b4d42a6a3 Mon Sep 17 00:00:00 2001 From: Saulius Gurklys Date: Sat, 19 Dec 2015 12:57:32 +0200 Subject: [PATCH] Update smarty_internal_compile_capture.php Added missing (). Without them "{if}", with several "$smarty.capture.X" in condition, generates incorrect code. e.g. before this change, smarty code ``` {if $smarty.capture.A || $smarty.capture.B} ``` generates code ```php _cache['__smarty_capture']['A']) ? $_smarty_tpl->_cache['__smarty_capture']['A'] : null || isset($_smarty_tpl->_cache['__smarty_capture']['B']) ? $_smarty_tpl->_cache['__smarty_capture']['B'] : null) {?> ``` which evaluates incorrectly. After this change generated code is ```php _cache['__smarty_capture']['A']) ? $_smarty_tpl->_cache['__smarty_capture']['A'] : null) || (isset($_smarty_tpl->_cache['__smarty_capture']['B']) ? $_smarty_tpl->_cache['__smarty_capture']['B'] : null)) {?> ``` which evaluates correctly. --- libs/sysplugins/smarty_internal_compile_capture.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sysplugins/smarty_internal_compile_capture.php b/libs/sysplugins/smarty_internal_compile_capture.php index d77f59607..be45f3e94 100644 --- a/libs/sysplugins/smarty_internal_compile_capture.php +++ b/libs/sysplugins/smarty_internal_compile_capture.php @@ -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->_cache['__smarty_capture']['{$name}']) ? \$_smarty_tpl->_cache['__smarty_capture']['{$name}'] : null)"; } }