-bugfix and enhancement on subtemplate {include} and template {function} tags.

* Calling a template which has a nocache section could fail if it was
called from a cached and a not cached subtemplate.
* Calling the same subtemplate cached and not cached with the
$smarty->merge_compiled_includes enabled could cause problems
* Many smaller related changes
This commit is contained in:
Uwe Tews
2014-11-01 22:42:34 +01:00
parent 5f2f292739
commit bc13ebbc9b
14 changed files with 456 additions and 308 deletions
@@ -86,7 +86,7 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
*
* @return bool true if compiling succeeded, false if it failed
*/
protected function doCompile($_content)
protected function doCompile($_content, $isTemplateSource = false)
{
/* here is where the compiling takes place. Smarty
tags in the templates are replaces with PHP code,
@@ -94,6 +94,9 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
// init the lexer/parser to compile the template
$this->lex = new $this->lexer_class($_content, $this);
$this->parser = new $this->parser_class($this->lex, $this);
if ($isTemplateSource) {
$this->parser->insertPhpCode("<?php\n\$_smarty_tpl->properties['nocache_hash'] = '{$this->nocache_hash}';\n?>\n");
}
if ($this->inheritance_child) {
// start state on child templates
$this->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);