- improvement/bugfix when Smarty::fetch() is called on a template object the inheritance and tplFunctions property

should be copied to the called template object
This commit is contained in:
uwetews
2016-10-23 18:34:59 +02:00
parent 29cbe10857
commit d79edd2fe0
3 changed files with 15 additions and 3 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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