summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruwetews <uwe.tews@googlemail.com>2016-09-30 02:30:39 +0200
committeruwetews <uwe.tews@googlemail.com>2016-09-30 02:30:39 +0200
commit80af6ea2b511122f9007cf90ec91ef010f80331c (patch)
treef304a802ce3d6e6b00bf4687ff26c821ff41b4e8
parent68ab01dc9e31fa451f39bcb4b958cfd6ac4281eb (diff)
downloadsmarty-80af6ea2b511122f9007cf90ec91ef010f80331c.tar.gz
smarty-80af6ea2b511122f9007cf90ec91ef010f80331c.tar.bz2
smarty-80af6ea2b511122f9007cf90ec91ef010f80331c.zip
- improvement new Smarty::$extends_recursion property to disable execution of {extends} in templates called by extends resource
https://github.com/smarty-php/smarty/issues/296
-rw-r--r--libs/sysplugins/smarty_internal_resource_extends.php5
-rw-r--r--libs/sysplugins/smarty_internal_runtime_getincludepath.php2
-rw-r--r--libs/sysplugins/smarty_internal_runtime_inheritance.php2
3 files changed, 5 insertions, 4 deletions
diff --git a/libs/sysplugins/smarty_internal_resource_extends.php b/libs/sysplugins/smarty_internal_resource_extends.php
index 4a712e52..4f1f09ea 100644
--- a/libs/sysplugins/smarty_internal_resource_extends.php
+++ b/libs/sysplugins/smarty_internal_resource_extends.php
@@ -37,10 +37,11 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource
$uid = '';
$sources = array();
$components = explode('|', $source->name);
+ $smarty = &$source->smarty;
$exists = true;
foreach ($components as $component) {
/* @var \Smarty_Template_Source $_s */
- $_s = Smarty_Template_Source::load(null, $source->smarty, $component);
+ $_s = Smarty_Template_Source::load(null, $smarty, $component);
if ($_s->type == 'php') {
throw new SmartyException("Resource type {$_s->type} cannot be used with the extends resource type");
}
@@ -85,7 +86,7 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource
public function getContent(Smarty_Template_Source $source)
{
if (!$source->exists) {
- throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
+ throw new SmartyException("Unable to load template '{$source->type}:{$source->name}'");
}
$_components = array_reverse($source->components);
diff --git a/libs/sysplugins/smarty_internal_runtime_getincludepath.php b/libs/sysplugins/smarty_internal_runtime_getincludepath.php
index e12b0c57..4c1f7548 100644
--- a/libs/sysplugins/smarty_internal_runtime_getincludepath.php
+++ b/libs/sysplugins/smarty_internal_runtime_getincludepath.php
@@ -87,7 +87,7 @@ class Smarty_Internal_Runtime_GetIncludePath
$_dirs = (array) explode(PATH_SEPARATOR, $_i_path);
foreach ($_dirs as $_path) {
if (is_dir($_path)) {
- $this->_include_dirs[] = $smarty->_realpath($_path . $smarty->ds, true);
+ $this->_include_dirs[] = $smarty->_realpath($_path . $smarty->ds);
}
}
return true;
diff --git a/libs/sysplugins/smarty_internal_runtime_inheritance.php b/libs/sysplugins/smarty_internal_runtime_inheritance.php
index e49b9889..66c38407 100644
--- a/libs/sysplugins/smarty_internal_runtime_inheritance.php
+++ b/libs/sysplugins/smarty_internal_runtime_inheritance.php
@@ -111,7 +111,7 @@ class Smarty_Internal_Runtime_Inheritance
ob_end_clean();
$this->state = 2;
}
- if (isset($template) && ($tpl->parent->source->type !== 'extends' || $tpl->smarty->extends_recursion)) {
+ if (isset($template) && (($tpl->parent->_isTplObj() && $tpl->parent->source->type !== 'extends') || $tpl->smarty->extends_recursion)) {
$tpl->_subTemplateRender($template, $tpl->cache_id, $tpl->compile_id, $tpl->caching ? 9999 : 0,
$tpl->cache_lifetime, array(), 2, false, $uid, $func);
}