remove \r from template source before compiling

This commit is contained in:
Uwe Tews
2015-01-02 08:25:27 +01:00
parent 97e7948e16
commit 8c1f400c09

View File

@@ -53,7 +53,7 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
* array of vars which can be compiled in local scope * array of vars which can be compiled in local scope
* *
* @var array * @var array
*/ */
public $local_var = array(); public $local_var = array();
/** /**
@@ -85,7 +85,7 @@ class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCom
tags in the templates are replaces with PHP code, tags in the templates are replaces with PHP code,
then written to compiled files. */ then written to compiled files. */
// init the lexer/parser to compile the template // init the lexer/parser to compile the template
$this->lex = new $this->lexer_class($_content, $this); $this->lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $_content), $this);
$this->parser = new $this->parser_class($this->lex, $this); $this->parser = new $this->parser_class($this->lex, $this);
if ($isTemplateSource) { if ($isTemplateSource) {
$this->parser->insertPhpCode("<?php\n\$_smarty_tpl->properties['nocache_hash'] = '{$this->nocache_hash}';\n?>\n"); $this->parser->insertPhpCode("<?php\n\$_smarty_tpl->properties['nocache_hash'] = '{$this->nocache_hash}';\n?>\n");