From 761e516a323fce968cb55923ff9fdb12f20cd47b Mon Sep 17 00:00:00 2001 From: uwetews Date: Sun, 7 Aug 2016 15:31:01 +0200 Subject: [PATCH] - bugfix update of 04.08.2016 was incomplete --- change_log.txt | 7 +++++-- libs/Smarty.class.php | 2 +- .../sysplugins/smarty_internal_compile_call.php | 4 ++-- .../smarty_internal_runtime_codeframe.php | 17 ++++++++++------- .../smarty_internal_runtime_tplfunction.php | 1 + 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/change_log.txt b/change_log.txt index 509c51d0..cb3ef9c8 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,9 +1,12 @@  ===== 3.1.30-dev ===== (xx.xx.xx) - 05.08.2015 + 07.08.2016 + - bugfix update of 04.08.2016 was incomplete + + 05.08.2016 - bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264 - updated error checking at template and config default handler - 04.08.2015 + 04.08.2016 - improvement move template function source parameter into extension 26.07.2016 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 15241504..7d958fab 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/91'; + const SMARTY_VERSION = '3.1.30-dev/92'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_compile_call.php b/libs/sysplugins/smarty_internal_compile_call.php index 739df5ec..33480dee 100644 --- a/libs/sysplugins/smarty_internal_compile_call.php +++ b/libs/sysplugins/smarty_internal_compile_call.php @@ -79,10 +79,10 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase // was there an assign attribute if (isset($_assign)) { $_output = - "smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});\n\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n"; + "ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});\n\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n"; } else { $_output = - "smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});?>\n"; + "ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});?>\n"; } return $_output; } diff --git a/libs/sysplugins/smarty_internal_runtime_codeframe.php b/libs/sysplugins/smarty_internal_runtime_codeframe.php index efb08a89..66faf67b 100644 --- a/libs/sysplugins/smarty_internal_runtime_codeframe.php +++ b/libs/sysplugins/smarty_internal_runtime_codeframe.php @@ -35,16 +35,10 @@ class Smarty_Internal_Runtime_CodeFrame $properties[ 'has_nocache_code' ] = $_template->compiled->has_nocache_code; $properties[ 'file_dependency' ] = $_template->compiled->file_dependency; $properties[ 'includes' ] = $_template->compiled->includes; - if (!empty($compiler->tpl_function)) { - $properties[ 'tpl_function' ] = $compiler->tpl_function; - } - } else { + } else { $properties[ 'has_nocache_code' ] = $_template->cached->has_nocache_code; $properties[ 'file_dependency' ] = $_template->cached->file_dependency; $properties[ 'cache_lifetime' ] = $_template->cache_lifetime; - if (!empty($_template->tpl_function)) { - $properties[ 'tpl_function' ] = $_template->tpl_function; - } } $output = "tpl_function)) { + $output .= "\$_smarty_tpl->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " . + var_export($compiler->tpl_function, true) . ");\n"; + } + if ($cache && isset($_template->ext->_tplFunction)) { + $output .= "\$_smarty_tpl->ext->_tplFunction->registerTplFunctions(\$_smarty_tpl, " . + var_export($_template->ext->_tplFunction->getTplFunction(), true) . ");\n"; + + } // include code for plugins if (!$cache) { if (!empty($_template->compiled->required_plugins[ 'compiled' ])) { diff --git a/libs/sysplugins/smarty_internal_runtime_tplfunction.php b/libs/sysplugins/smarty_internal_runtime_tplfunction.php index 239dbdfa..f75028a8 100644 --- a/libs/sysplugins/smarty_internal_runtime_tplfunction.php +++ b/libs/sysplugins/smarty_internal_runtime_tplfunction.php @@ -120,6 +120,7 @@ class Smarty_Internal_Runtime_TplFunction } // add template function code to cache file if (isset($tplPtr->cached)) { + /* @var Smarty_CacheResource $cache */ $cache = $tplPtr->cached; $content = $cache->read($tplPtr); if ($content) {