mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||||
|
05.08.2015
|
||||||
|
- bugfix compiling of templates failed when the Smarty delimiter did contain '/' https://github.com/smarty-php/smarty/issues/264
|
||||||
|
|
||||||
04.08.2015
|
04.08.2015
|
||||||
- improvement move template function source parameter into extension
|
- improvement move template function source parameter into extension
|
||||||
|
|
||||||
|
@@ -226,15 +226,15 @@ class Smarty_Internal_Templatelexer
|
|||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
$this->counter = 0;
|
$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->counter += strlen($match[0]);
|
||||||
}
|
}
|
||||||
$this->line = 1;
|
$this->line = 1;
|
||||||
$this->smarty = $compiler->smarty;
|
$this->smarty = $compiler->smarty;
|
||||||
$this->compiler = $compiler;
|
$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->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->rdel_length = strlen($this->smarty->right_delimiter);
|
||||||
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
|
$this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
|
||||||
$this->smarty_token_names['RDEL'] = $this->smarty->right_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;
|
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
|
||||||
}
|
}
|
||||||
comment {
|
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])) {
|
if (isset($match[0][1])) {
|
||||||
$to = $match[0][1] + strlen($match[0][0]);
|
$to = $match[0][1] + strlen($match[0][0]);
|
||||||
} else {
|
} else {
|
||||||
@@ -369,7 +369,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
}
|
}
|
||||||
text {
|
text {
|
||||||
$to = strlen($this->data);
|
$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])) {
|
if (isset($match[0][1])) {
|
||||||
$to = $match[0][1];
|
$to = $match[0][1];
|
||||||
}
|
}
|
||||||
@@ -540,7 +540,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
attr {
|
attr {
|
||||||
// resolve conflicts with shorttag and right_delimiter starting with '='
|
// 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) {
|
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->value = $match[0];
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||||
} else {
|
} else {
|
||||||
@@ -609,7 +609,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
}
|
}
|
||||||
text {
|
text {
|
||||||
$to = strlen($this->data);
|
$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])) {
|
if (isset($match[0][1])) {
|
||||||
$to = $match[0][1];
|
$to = $match[0][1];
|
||||||
} else {
|
} else {
|
||||||
|
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.30-dev/89';
|
const SMARTY_VERSION = '3.1.30-dev/90';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
|
@@ -203,15 +203,15 @@ class Smarty_Internal_Templatelexer
|
|||||||
{
|
{
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
$this->counter = 0;
|
$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->counter += strlen($match[ 0 ]);
|
||||||
}
|
}
|
||||||
$this->line = 1;
|
$this->line = 1;
|
||||||
$this->smarty = $compiler->smarty;
|
$this->smarty = $compiler->smarty;
|
||||||
$this->compiler = $compiler;
|
$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->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->rdel_length = strlen($this->smarty->right_delimiter);
|
||||||
$this->smarty_token_names[ 'LDEL' ] = $this->smarty->left_delimiter;
|
$this->smarty_token_names[ 'LDEL' ] = $this->smarty->left_delimiter;
|
||||||
$this->smarty_token_names[ 'RDEL' ] = $this->smarty->right_delimiter;
|
$this->smarty_token_names[ 'RDEL' ] = $this->smarty->right_delimiter;
|
||||||
@@ -348,7 +348,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
function yy_r1_2()
|
function yy_r1_2()
|
||||||
{
|
{
|
||||||
|
|
||||||
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 ])) {
|
if (isset($match[ 0 ][ 1 ])) {
|
||||||
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
|
$to = $match[ 0 ][ 1 ] + strlen($match[ 0 ][ 0 ]);
|
||||||
} else {
|
} else {
|
||||||
@@ -408,7 +408,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
{
|
{
|
||||||
|
|
||||||
$to = strlen($this->data);
|
$to = strlen($this->data);
|
||||||
preg_match("~($this->ldel)|(<[?]((php\s+|=)|\s+))|(<[%])|(<[?]xml\s+)|(<script\s+language\s*=\s*[\"']?\s*php\s*[\"']?\s*>)|([?][>])|([%][>])~i",
|
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);
|
$this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
|
||||||
if (isset($match[ 0 ][ 1 ])) {
|
if (isset($match[ 0 ][ 1 ])) {
|
||||||
$to = $match[ 0 ][ 1 ];
|
$to = $match[ 0 ][ 1 ];
|
||||||
@@ -814,7 +814,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) ==
|
if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) ==
|
||||||
$this->smarty->right_delimiter
|
$this->smarty->right_delimiter
|
||||||
) {
|
) {
|
||||||
preg_match("~\s+~", $this->value, $match);
|
preg_match("/\s+/", $this->value, $match);
|
||||||
$this->value = $match[ 0 ];
|
$this->value = $match[ 0 ];
|
||||||
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
|
||||||
} else {
|
} else {
|
||||||
@@ -985,7 +985,7 @@ class Smarty_Internal_Templatelexer
|
|||||||
{
|
{
|
||||||
|
|
||||||
$to = strlen($this->data);
|
$to = strlen($this->data);
|
||||||
preg_match("~{$this->ldel}[/]?literal{$this->rdel}~i", $this->data, $match, PREG_OFFSET_CAPTURE,
|
preg_match("/{$this->ldel}[\/]?literal{$this->rdel}/i", $this->data, $match, PREG_OFFSET_CAPTURE,
|
||||||
$this->counter);
|
$this->counter);
|
||||||
if (isset($match[ 0 ][ 1 ])) {
|
if (isset($match[ 0 ][ 1 ])) {
|
||||||
$to = $match[ 0 ][ 1 ];
|
$to = $match[ 0 ][ 1 ];
|
||||||
|
Reference in New Issue
Block a user