From 071f9af42f061bf36664dd8e944b4e7ec82e3bac Mon Sep 17 00:00:00 2001 From: "Uwe.Tews@googlemail.com" Date: Wed, 16 Jul 2014 21:40:57 +0000 Subject: [PATCH] anchor BOM regex to front of file --- libs/sysplugins/smarty_internal_configfilelexer.php | 2 +- libs/sysplugins/smarty_internal_templatelexer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/sysplugins/smarty_internal_configfilelexer.php b/libs/sysplugins/smarty_internal_configfilelexer.php index d5b50775..f0292196 100644 --- a/libs/sysplugins/smarty_internal_configfilelexer.php +++ b/libs/sysplugins/smarty_internal_configfilelexer.php @@ -33,7 +33,7 @@ class Smarty_Internal_Configfilelexer self::instance($this); $this->data = $data . "\n"; //now all lines are \n-terminated $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->line = 1; diff --git a/libs/sysplugins/smarty_internal_templatelexer.php b/libs/sysplugins/smarty_internal_templatelexer.php index 45583d9b..5a04d0b6 100644 --- a/libs/sysplugins/smarty_internal_templatelexer.php +++ b/libs/sysplugins/smarty_internal_templatelexer.php @@ -82,7 +82,7 @@ class Smarty_Internal_Templatelexer // $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data); $this->data = $data; $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->line = 1;