diff options
| author | uwetews <uwe.tews@googlemail.com> | 2016-08-07 15:31:01 +0200 |
|---|---|---|
| committer | uwetews <uwe.tews@googlemail.com> | 2016-08-07 15:31:01 +0200 |
| commit | 761e516a323fce968cb55923ff9fdb12f20cd47b (patch) | |
| tree | f8769e84f8071b95601b0282b8bba27f830718c0 | |
| parent | 25ad0b3b5a25d9ef341c8ab8a75168de0fe4c986 (diff) | |
| download | smarty-761e516a323fce968cb55923ff9fdb12f20cd47b.tar.gz smarty-761e516a323fce968cb55923ff9fdb12f20cd47b.tar.bz2 smarty-761e516a323fce968cb55923ff9fdb12f20cd47b.zip | |
- bugfix update of 04.08.2016 was incomplete
| -rw-r--r-- | change_log.txt | 7 | ||||
| -rw-r--r-- | libs/Smarty.class.php | 2 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_compile_call.php | 4 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_internal_runtime_codeframe.php | 17 | ||||
| -rw-r--r-- | libs/sysplugins/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 = - "<?php ob_start();\n\$_smarty_tpl->smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});\n\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n"; + "<?php ob_start();\n\$_smarty_tpl->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});\n\$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n"; } else { $_output = - "<?php \$_smarty_tpl->smarty->ext->_tplFunction->callTemplateFunction(\$_smarty_tpl, {$_name}, {$_params}, {$_nocache});?>\n"; + "<?php \$_smarty_tpl->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 = "<?php\n"; $output .= "/* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . @@ -54,6 +48,15 @@ class Smarty_Internal_Runtime_CodeFrame ($cache ? 'true' : 'false') . ")"; $output .= "if ({$dec}) {\n"; $output .= "function {$properties['unifunc']} (Smarty_Internal_Template \$_smarty_tpl) {\n"; + if (!$cache && !empty($compiler->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) { |
