summaryrefslogtreecommitdiff
path: root/lexer/smarty_internal_templatelexer.plex
diff options
context:
space:
mode:
authoruwetews <uwe.tews@googlemail.com>2016-08-05 01:00:51 +0200
committeruwetews <uwe.tews@googlemail.com>2016-08-05 01:00:51 +0200
commit04301645d60b08a00c919536640586cf6a8c1573 (patch)
treef6b2f433de7cedc2512be39bf86d1750874eb575 /lexer/smarty_internal_templatelexer.plex
parente96a218e8b8b5148846d69b7bee04104a7036235 (diff)
downloadsmarty-04301645d60b08a00c919536640586cf6a8c1573.tar.gz
smarty-04301645d60b08a00c919536640586cf6a8c1573.tar.bz2
smarty-04301645d60b08a00c919536640586cf6a8c1573.zip
- bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264
Diffstat (limited to 'lexer/smarty_internal_templatelexer.plex')
-rw-r--r--lexer/smarty_internal_templatelexer.plex14
1 files changed, 7 insertions, 7 deletions
diff --git a/lexer/smarty_internal_templatelexer.plex b/lexer/smarty_internal_templatelexer.plex
index 44ab67e6..312c6fd0 100644
--- a/lexer/smarty_internal_templatelexer.plex
+++ b/lexer/smarty_internal_templatelexer.plex
@@ -226,15 +226,15 @@ class Smarty_Internal_Templatelexer
{
$this->data = $data;
$this->counter = 0;
- if (preg_match('~^\xEF\xBB\xBF~i', $this->data, $match)) {
+ if (preg_match('/^\xEF\xBB\xBF/i', $this->data, $match)) {
$this->counter += strlen($match[0]);
}
$this->line = 1;
$this->smarty = $compiler->smarty;
$this->compiler = $compiler;
- $this->ldel = preg_quote($this->smarty->left_delimiter, '~');
+ $this->ldel = preg_quote($this->smarty->left_delimiter, '/');
$this->ldel_length = strlen($this->smarty->left_delimiter);
- $this->rdel = preg_quote($this->smarty->right_delimiter, '~');
+ $this->rdel = preg_quote($this->smarty->right_delimiter, '/');
$this->rdel_length = strlen($this->smarty->right_delimiter);
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
$this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
@@ -331,7 +331,7 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
comment {
- preg_match("~[*]{$this->rdel}~",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
+ preg_match("/[*]{$this->rdel}/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
if (isset($match[0][1])) {
$to = $match[0][1] + strlen($match[0][0]);
} else {
@@ -369,7 +369,7 @@ class Smarty_Internal_Templatelexer
}
text {
$to = strlen($this->data);
- preg_match("~($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])~i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
+ preg_match("/($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])/i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
if (isset($match[0][1])) {
$to = $match[0][1];
}
@@ -540,7 +540,7 @@ class Smarty_Internal_Templatelexer
attr {
// resolve conflicts with shorttag and right_delimiter starting with '='
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == $this->smarty->right_delimiter) {
- preg_match("~\s+~",$this->value,$match);
+ preg_match("/\s+/",$this->value,$match);
$this->value = $match[0];
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
} else {
@@ -609,7 +609,7 @@ class Smarty_Internal_Templatelexer
}
text {
$to = strlen($this->data);
- preg_match("~{$this->ldel}[/]?literal{$this->rdel}~i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
+ preg_match("/{$this->ldel}[\/]?literal{$this->rdel}/i",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
if (isset($match[0][1])) {
$to = $match[0][1];
} else {