From 4ecc75344f3de1ba1fb3fb63081f2d36e75066f6 Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Fri, 20 Mar 2015 00:41:55 +0100 Subject: [PATCH] - bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452} --- change_log.txt | 3 +++ libs/Smarty.class.php | 2 +- libs/sysplugins/smarty_internal_extension_codeframe.php | 9 ++++++++- libs/sysplugins/smarty_internal_templatecompilerbase.php | 3 --- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/change_log.txt b/change_log.txt index 46f9165c..ac21d395 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@  ===== 3.1.22-dev ===== (xx.xx.2015) + 20.03.2015 + - bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452} + 16.03.2015 - bugfix problems with {function}{/function} and {call} tags in different subtemplate cache files {forum topic 25452} - bugfix Smarty_Security->allow_constants=false; did not disallow direct usage of defined constants like {SMARTY_DIR} {forum topic 25457} diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 665eb33e..aaf66512 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.22-dev/14'; + const SMARTY_VERSION = '3.1.22-dev/11'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_extension_codeframe.php b/libs/sysplugins/smarty_internal_extension_codeframe.php index 4f5c557a..129d1295 100644 --- a/libs/sysplugins/smarty_internal_extension_codeframe.php +++ b/libs/sysplugins/smarty_internal_extension_codeframe.php @@ -32,12 +32,19 @@ class Smarty_Internal_Extension_CodeFrame if (!isset($_template->properties['unifunc'])) { $_template->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true)); } + $properties = $_template->properties; + if (!$cache) { + unset($properties['tpl_function']); + if (!empty($_template->compiler->templateProperties)) { + $properties['tpl_function'] = $_template->compiler->templateProperties['tpl_function']; + } + } $output = "properties['nocache_hash']}%%*/\n"; if ($_template->smarty->direct_access_security) { $output .= "if(!defined('SMARTY_DIR')) exit('no direct access allowed');\n"; } - $output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($_template->properties, true) . ',' . ($cache ? 'true' : 'false') . ");\n"; + $output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ");\n"; $output .= "/*/%%SmartyHeaderCode%%*/\n"; $output .= "if (\$_valid && !is_callable('{$_template->properties['unifunc']}')) {\n"; $output .= "function {$_template->properties['unifunc']} (\$_smarty_tpl) {\n"; diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index bbc6365f..a7f81f4a 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -325,9 +325,6 @@ abstract class Smarty_Internal_TemplateCompilerBase if ((isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) && !$this->suppressFilter && $_compiled_code != '') { $_compiled_code = Smarty_Internal_Filter_Handler::runFilter('post', $_compiled_code, $template); } - if (!empty($this->templateProperties)) { - $this->template->properties['tpl_function'] = $this->templateProperties['tpl_function']; - } if ($this->suppressTemplatePropertyHeader) { $_compiled_code .= $merged_code; } else {