- bugfix {include} with variable file name must not create by default individual cache file (since 3.1.22) https://github.com/smarty-php/smarty/issues/43

This commit is contained in:
Uwe Tews
2015-05-27 22:24:24 +02:00
parent 0434f34bdd
commit 63b1d343b8
3 changed files with 22 additions and 21 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.25-dev===== (xx.xx.2015)  ===== 3.1.25-dev===== (xx.xx.2015)
27.05.2015
- bugfix {include} with variable file name must not create by default individual cache file (since 3.1.22) https://github.com/smarty-php/smarty/issues/43
24.05.2015 24.05.2015
- bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42 - bugfix if condition string 'neq' broken due to a typo https://github.com/smarty-php/smarty/issues/42

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.25-dev/1'; const SMARTY_VERSION = '3.1.25-dev/2';
/** /**
* define variable scopes * define variable scopes

View File

@@ -101,14 +101,13 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
// flag if included template code should be merged into caller // flag if included template code should be merged into caller
$merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) || $_attr['inline'] === true) && !$compiler->template->source->recompiled; $merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) || $_attr['inline'] === true) && !$compiler->template->source->recompiled;
if ($merge_compiled_includes && $_attr['inline'] !== true) {
// variable template name ? // variable template name ?
if ($compiler->has_variable_string || !((substr_count($include_file, '"') == 2 || substr_count($include_file, "'") == 2)) if ($compiler->has_variable_string || !((substr_count($include_file, '"') == 2 || substr_count($include_file, "'") == 2)) || substr_count($include_file, '(') != 0 || substr_count($include_file, '$_smarty_tpl->') != 0) {
|| substr_count($include_file, '(') != 0 || substr_count($include_file, '$_smarty_tpl->') != 0
) {
$merge_compiled_includes = false; $merge_compiled_includes = false;
if ($compiler->template->caching) { if ($compiler->template->caching) {
// must use individual cache file // must use individual cache file
$_attr['caching'] = 1; //$_attr['caching'] = 1;
} }
if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes && $_attr['inline'] !== true) { if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes && $_attr['inline'] !== true) {
$compiler->trigger_template_error(' variable template file names not allow within {block} tags'); $compiler->trigger_template_error(' variable template file names not allow within {block} tags');
@@ -116,19 +115,18 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
} }
// variable compile_id? // variable compile_id?
if (isset($_attr['compile_id'])) { if (isset($_attr['compile_id'])) {
if (!((substr_count($_attr['compile_id'], '"') == 2 || substr_count($_attr['compile_id'], "'") == 2 || is_numeric($_attr['compile_id']))) if (!((substr_count($_attr['compile_id'], '"') == 2 || substr_count($_attr['compile_id'], "'") == 2 || is_numeric($_attr['compile_id']))) || substr_count($_attr['compile_id'], '(') != 0 || substr_count($_attr['compile_id'], '$_smarty_tpl->') != 0) {
|| substr_count($_attr['compile_id'], '(') != 0 || substr_count($_attr['compile_id'], '$_smarty_tpl->') != 0
) {
$merge_compiled_includes = false; $merge_compiled_includes = false;
if ($compiler->template->caching) { if ($compiler->template->caching) {
// must use individual cache file // must use individual cache file
$_attr['caching'] = 1; //$_attr['caching'] = 1;
} }
if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes && $_attr['inline'] !== true) { if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes && $_attr['inline'] !== true) {
$compiler->trigger_template_error(' variable compile_id not allow within {block} tags'); $compiler->trigger_template_error(' variable compile_id not allow within {block} tags');
} }
} }
} }
}
/* /*
* if the {include} tag provides individual parameter for caching or compile_id * if the {include} tag provides individual parameter for caching or compile_id