anchor BOM regex to front of file

This commit is contained in:
Uwe.Tews@googlemail.com
2014-07-16 21:40:57 +00:00
parent 77292d394a
commit 071f9af42f
2 changed files with 2 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ class Smarty_Internal_Configfilelexer
self::instance($this); self::instance($this);
$this->data = $data . "\n"; //now all lines are \n-terminated $this->data = $data . "\n"; //now all lines are \n-terminated
$this->counter = 0; $this->counter = 0;
if (preg_match('/\xEF\xBB\xBF/', $this->data, $match)) { if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
$this->counter += strlen($match[0]); $this->counter += strlen($match[0]);
} }
$this->line = 1; $this->line = 1;

View File

@@ -82,7 +82,7 @@ class Smarty_Internal_Templatelexer
// $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data); // $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data);
$this->data = $data; $this->data = $data;
$this->counter = 0; $this->counter = 0;
if (preg_match('/\xEF\xBB\xBF/', $this->data, $match)) { if (preg_match('/^\xEF\xBB\xBF/', $this->data, $match)) {
$this->counter += strlen($match[0]); $this->counter += strlen($match[0]);
} }
$this->line = 1; $this->line = 1;