diff --git a/change_log.txt b/change_log.txt index b5255a50..ebebdb32 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,8 @@ ===== 3.1.31-dev ===== (xx.xx.xx) + 23.10.2016 + - improvement/bugfix when Smarty::fetch() is called on a template object the inheritance and tplFunctions property + should be copied to the called template object + 21.10.2016 - bugfix for compile locking touched timestamp of old compiled file was not restored on compilation error https://github.com/smarty-php/smarty/issues/308 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 97fcb445..dc68eb30 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -114,7 +114,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.31-dev/38'; + const SMARTY_VERSION = '3.1.31-dev/39'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_templatebase.php b/libs/sysplugins/smarty_internal_templatebase.php index 39d53a27..bdc184ac 100644 --- a/libs/sysplugins/smarty_internal_templatebase.php +++ b/libs/sysplugins/smarty_internal_templatebase.php @@ -14,7 +14,7 @@ * @package Smarty * @subpackage Template * - * @property int $_objType + * @property int $_objType * * The following methods will be dynamically loaded by the extension handler when they are called. * They are located in a corresponding Smarty_Internal_Method_xxxx class @@ -157,18 +157,26 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data $template = $this; } } elseif (is_object($template)) { + /* @var Smarty_Internal_Template $template */ if (!isset($template->_objType) || !$template->_isTplObj()) { throw new SmartyException($function . '():Template object expected'); } } else { // get template object - /* @var Smarty_Internal_Template $template */ $saveVars = false; $template = $smarty->createTemplate($template, $cache_id, $compile_id, $parent ? $parent : $this, false); if ($this->_objType == 1) { // set caching in template object $template->caching = $this->caching; + } else { + /* @var Smarty_Internal_Template $this */ + $template->tplFunctions = $this->tplFunctions; + $template->inheritance = $this->inheritance; + } + /* @var Smarty_Internal_Template $parent */ + if (isset($parent->_objType) && ($parent->_objType == 2) && !empty($parent->tplFunctions)) { + $template->tplFunctions = array_merge($parent->tplFunctions, $template->tplFunctions); } } // fetch template content