- bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246

This commit is contained in:
uwetews
2016-07-18 23:43:58 +02:00
parent d854219696
commit 5fd21b7361
3 changed files with 43 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
- bugfix {foreach} if key variable and item@key attribute have been used both the key variable was not updated https://github.com/smarty-php/smarty/issues/254 - bugfix {foreach} if key variable and item@key attribute have been used both the key variable was not updated https://github.com/smarty-php/smarty/issues/254
- bugfix modifier on plugins like {plugin|modifier ... } did fail when the plugin does return an array https://github.com/smarty-php/smarty/issues/228 - bugfix modifier on plugins like {plugin|modifier ... } did fail when the plugin does return an array https://github.com/smarty-php/smarty/issues/228
- bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244 - bugfix avoid opcache_invalidate to result in ErrorException when opcache.restrict_api is not empty https://github.com/smarty-php/smarty/pull/244
- bugfix multiple {include} with relative filepath within {block}{/block} could fail https://github.com/smarty-php/smarty/issues/246
14.07.2016 14.07.2016
- bugfix wrong parameter on compileAllTemplates() and compileAllConfig() https://github.com/smarty-php/smarty/issues/231 - bugfix wrong parameter on compileAllTemplates() and compileAllConfig() https://github.com/smarty-php/smarty/issues/231

View File

@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.30-dev/83'; const SMARTY_VERSION = '3.1.30-dev/84';
/** /**
* define variable scopes * define variable scopes

View File

@@ -42,7 +42,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
/** /**
* Source instance * Source instance
* *
* @var Smarty_Template_Source|Smarty_Template_Config * @var \Smarty_Template_Source|\Smarty_Template_Config
*/ */
public $source = null; public $source = null;
@@ -223,6 +223,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
if (!empty($this->tpl_function)) { if (!empty($this->tpl_function)) {
$this->parent->tpl_function = array_merge($this->parent->tpl_function, $this->tpl_function); $this->parent->tpl_function = array_merge($this->parent->tpl_function, $this->tpl_function);
} }
/**
foreach ($this->compiled->required_plugins as $code => $tmp1) { foreach ($this->compiled->required_plugins as $code => $tmp1) {
foreach ($tmp1 as $name => $tmp) { foreach ($tmp1 as $name => $tmp) {
foreach ($tmp as $type => $data) { foreach ($tmp as $type => $data) {
@@ -230,6 +231,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
} }
} }
} }
* **/
} }
if (!$no_output_filter && if (!$no_output_filter &&
(!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) && (!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) &&
@@ -262,6 +264,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
$forceTplCache, $uid = null, $content_func = null) $forceTplCache, $uid = null, $content_func = null)
{ {
$tpl = clone $this; $tpl = clone $this;
if (isset($this->inheritance)) {
unset($tpl->startRenderCallbacks[ 'inheritance' ], $tpl->endRenderCallbacks[ 'inheritance' ]);
}
$tpl->parent = $this; $tpl->parent = $this;
$smarty = &$this->smarty; $smarty = &$this->smarty;
$_templateId = $smarty->_getTemplateId($template, $cache_id, $compile_id, $caching, $tpl); $_templateId = $smarty->_getTemplateId($template, $cache_id, $compile_id, $caching, $tpl);
@@ -377,6 +382,41 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
} }
} }
/**
* Call plugin
*
* @param array $params parameter array
* @param string $type plugin type
* @param string $pluginName plugin name
*
* @return mixed
* @throws \SmartyException
*/
public function _executePlugin($params, $type, $pluginName, $content = null, &$repeat = null)
{
if (isset($this->smarty->_pluginCache[ $pluginName ][ $type ])) {
$callback = $this->smarty->_pluginCache[ $pluginName ][ $type ][0];
} else {
$pluginInfo = $this->smarty->_getPluginInfo($type, $pluginName);
if ($pluginInfo === false) {
throw new SmartyException("plugin '{$pluginName}' not callable");
}
$callback = $pluginInfo[0];
}
if ($type == Smarty::PLUGIN_MODIFIER) {
return call_user_func_array($callback, $params);
} else if ($type == Smarty::PLUGIN_BLOCK) {
if (!is_array($callback)) {
return $callback($params, $content, $this, $repeat);
} else if (is_object($callback[0])){
return $callback[0]->{$callback[1]}($params, $content, $this, $repeat);
} else {
return $callback[0]::{$callback[1]}($params, $content, $this, $repeat);
}
}
return call_user_func_array($callback, array($params, $this));
}
/** /**
* Check if parent is template object * Check if parent is template object
* *