Merge branch 'master' into use-classmaps

This commit is contained in:
AnrDaemon
2018-11-26 21:21:43 +03:00
13 changed files with 1453 additions and 1270 deletions

View File

@@ -10,8 +10,7 @@ matrix:
- php: 5.3 - php: 5.3
dist: precise dist: precise
- php: 5.4 - php: 5.4
dist: precise - php: 5.5
- php: 5.5
- php: 5.6 - php: 5.6
- php: 7.0 - php: 7.0
- php: 7.1 - php: 7.1

View File

@@ -35,13 +35,13 @@ Smarty 3.1.32
will be treated now as literal. (This does apply for any number of delimiter repeatations). will be treated now as literal. (This does apply for any number of delimiter repeatations).
However {{foo}} is not an literal but will be interpreted as a recursive Smarty tag. However {{foo}} is not an literal but will be interpreted as a recursive Smarty tag.
If you use If you use
$smarty->setLiteral(array('{{','}}')); $smarty->setLiterals(array('{{','}}'));
{{foo}} is now a literal as well. {{foo}} is now a literal as well.
NOTE: In the last example nested Smarty tags starting with '{{' or ending with '}}' will not NOTE: In the last example nested Smarty tags starting with '{{' or ending with '}}' will not
work any longer, but this should be very very raw occouring restriction. work any longer, but this should be very very raw occouring restriction.
B) Example 2 B) Example 2
Assume your delimiter are '<-' , '->' and '<--' , '-->' shall be literals Assume your delimiter are '<-' , '->' and '<--' , '-->' shall be literals
$smarty->setLiteral(array('<--','-->')); $smarty->setLiterals(array('<--','-->'));
The capture buffers can now be accessed as array The capture buffers can now be accessed as array

View File

@@ -1,4 +1,32 @@
===== 3.1.33 release ===== 12.09.2018 ===== 3.1.34-dev-6 =====
30.10.2018
- bugfix a nested subblock in an inheritance child template was not replace by
outer level block with same name in same child template https://github.com/smarty-php/smarty/issues/500
29.10.2018
- bugfix Smarty::$php_handling == PHP_PASSTHRU (default) did eat the "\n" (newline) character if it did directly followed
a PHP tag like "?>" or other https://github.com/smarty-php/smarty/issues/501
14.10.2018
- bugfix autoloader exit shortcut https://github.com/smarty-php/smarty/issues/467
11.10.2018
- bugfix {insert} not works when caching is enabled and included template is present
https://github.com/smarty-php/smarty/issues/496
- bugfix in date-format modifier; NULL at date string or default_date did not produce correct output
https://github.com/smarty-php/smarty/pull/458
09.10.2018
- bugfix fix of 26.8.2017 https://github.com/smarty-php/smarty/issues/327
modifier is applied to sum expression https://github.com/smarty-php/smarty/issues/491
- bugfix indexed arrays could not be defined "array(...)""
18.09.2018
- bugfix large plain text template sections without a Smarty tag > 700kB could
could fail in version 3.1.32 and 3.1.33 because PHP preg_match() restrictions
https://github.com/smarty-php/smarty/issues/488
===== 3.1.33 release ===== 12.09.2018
===== 3.1.33-dev-12 ===== ===== 3.1.33-dev-12 =====
03.09.2018 03.09.2018
- bugfix {foreach} using new style property access like {$item@property} on - bugfix {foreach} using new style property access like {$item@property} on

View File

@@ -209,6 +209,20 @@ class Smarty_Internal_Templatelexer
*/ */
private $yy_global_pattern5 = null; private $yy_global_pattern5 = null;
/**
* preg token pattern for text
*
* @var null
*/
private $yy_global_text = null;
/**
* preg token pattern for literal
*
* @var null
*/
private $yy_global_literal = null;
/** /**
* constructor * constructor
* *
@@ -324,14 +338,13 @@ class Smarty_Internal_Templatelexer
if = ~(if|elseif|else if|while)\s+~ if = ~(if|elseif|else if|while)\s+~
for = ~for\s+~ for = ~for\s+~
makenocache = ~make_nocache\s+~ makenocache = ~make_nocache\s+~
array = ~array~
foreach = ~foreach(?![^\s])~ foreach = ~foreach(?![^\s])~
setfilter = ~setfilter\s+~ setfilter = ~setfilter\s+~
instanceof = ~\s+instanceof\s+~ instanceof = ~\s+instanceof\s+~
not = ~[!]\s*|not\s+~ not = ~[!]\s*|not\s+~
typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~ typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~
double_quote = ~["]~ double_quote = ~["]~
text = ~(.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["']?\s*php\s*["']?\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+~
literaltext = ~(.*?)(?=(SMARTYldel)SMARTYal[/]?literalSMARTYrdel)~
*/ */
/*!lex2php /*!lex2php
%statename TEXT %statename TEXT
@@ -339,7 +352,8 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
comment { comment {
preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter); $to = $this->dataLength;
preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/",$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,8 +383,17 @@ class Smarty_Internal_Templatelexer
phpstart { phpstart {
$this->compiler->getTagCompiler('private_php')->parsePhp($this); $this->compiler->getTagCompiler('private_php')->parsePhp($this);
} }
text { char {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; if (!isset($this->yy_global_text)) {
$this->yy_global_text = $this->replace('/(SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*[>]|[?][>]|[%][>]SMARTYliteral/isS');
}
$to = $this->dataLength;
preg_match($this->yy_global_text, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
if (isset($match[0][1])) {
$to = $match[0][1];
}
$this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
*/ */
/*!lex2php /*!lex2php
@@ -528,6 +551,9 @@ class Smarty_Internal_Templatelexer
at { at {
$this->token = Smarty_Internal_Templateparser::TP_AT; $this->token = Smarty_Internal_Templateparser::TP_AT;
} }
array openP {
$this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
}
hatch { hatch {
$this->token = Smarty_Internal_Templateparser::TP_HATCH; $this->token = Smarty_Internal_Templateparser::TP_HATCH;
} }
@@ -601,8 +627,19 @@ class Smarty_Internal_Templatelexer
$this->yypopstate(); $this->yypopstate();
} }
} }
literaltext { char {
$this->token = Smarty_Internal_Templateparser::TP_LITERAL; if (!isset($this->yy_global_literal)) {
$this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS');
}
$to = $this->dataLength;
preg_match($this->yy_global_literal, $this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
if (isset($match[0][1])) {
$to = $match[0][1];
} else {
$this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
}
$this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} }
*/ */
/*!lex2php /*!lex2php
@@ -648,7 +685,12 @@ class Smarty_Internal_Templatelexer
textdoublequoted { textdoublequoted {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
*/ char {
$to = $this->dataLength;
$this->value = substr($this->data,$this->counter,$to-$this->counter);
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
*/
} }

View File

@@ -226,7 +226,7 @@ class Smarty_Internal_Templateparser
%right VERT. %right VERT.
%left COLON. %left COLON.
%left UNIMATH.
// //
// complete template // complete template
@@ -632,16 +632,6 @@ expr(res) ::= expr(e) MATH(m) value(v). {
expr(res) ::= expr(e) UNIMATH(m) value(v). { expr(res) ::= expr(e) UNIMATH(m) value(v). {
res = e . trim(m) . v; res = e . trim(m) . v;
} }
// array
expr(res) ::= array(a). {
res = a;
}
// modifier
expr(res) ::= expr(e) modifierlist(l). {
res = $this->compiler->compileTag('private_modifier',array(),array('value'=>e,'modifierlist'=>l));
}
// if expression // if expression
// special conditions // special conditions
@@ -787,7 +777,10 @@ value(res) ::= NAMESPACE(c). {
res = c; res = c;
} }
// array
value(res) ::= arraydef(a). {
res = a;
}
// static class access // static class access
value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). { value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). {
if (!in_array(strtolower(c), array('self', 'parent')) && (!$this->security || $this->security->isTrustedStaticClassAccess(c, s, $this->compiler))) { if (!in_array(strtolower(c), array('self', 'parent')) && (!$this->security || $this->security->isTrustedStaticClassAccess(c, s, $this->compiler))) {
@@ -1109,6 +1102,9 @@ modparameters(res) ::= . {
modparameter(res) ::= COLON value(mp). { modparameter(res) ::= COLON value(mp). {
res = array(mp); res = array(mp);
} }
modparameter(res) ::= COLON UNIMATH(m) value(mp). {
res = array(trim(m).mp);
}
modparameter(res) ::= COLON array(mp). { modparameter(res) ::= COLON array(mp). {
res = array(mp); res = array(mp);
@@ -1191,7 +1187,10 @@ scond(res) ::= SINGLECOND(o). {
// //
// ARRAY element assignment // ARRAY element assignment
// //
array(res) ::= OPENB arrayelements(a) CLOSEB. { arraydef(res) ::= OPENB arrayelements(a) CLOSEB. {
res = 'array('.a.')';
}
arraydef(res) ::= ARRAYOPEN arrayelements(a) CLOSEP. {
res = 'array('.a.')'; res = 'array('.a.')';
} }

View File

@@ -90,7 +90,7 @@ class Smarty_Autoloader
*/ */
public static function autoload($class) public static function autoload($class)
{ {
if ($class[ 0 ] !== 'S' && strpos($class, 'Smarty') !== 0) { if ($class[ 0 ] !== 'S' || strpos($class, 'Smarty') !== 0) {
return; return;
} }
$_class = strtolower($class); $_class = strtolower($class);

View File

@@ -27,7 +27,7 @@
* @author Uwe Tews <uwe dot tews at gmail dot com> * @author Uwe Tews <uwe dot tews at gmail dot com>
* @author Rodney Rehm * @author Rodney Rehm
* @package Smarty * @package Smarty
* @version 3.1.33 * @version 3.1.34-dev
*/ */
/** /**
* set SMARTY_DIR to absolute path to Smarty library files. * set SMARTY_DIR to absolute path to Smarty library files.
@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.33'; const SMARTY_VERSION = '3.1.34-dev-7';
/** /**
* define variable scopes * define variable scopes
*/ */

View File

@@ -41,9 +41,9 @@ function smarty_modifier_date_format($string, $format = null, $default_date = ''
} }
$is_loaded = true; $is_loaded = true;
} }
if ($string !== '' && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') { if (!empty($string) && $string !== '0000-00-00' && $string !== '0000-00-00 00:00:00') {
$timestamp = smarty_make_timestamp($string); $timestamp = smarty_make_timestamp($string);
} elseif ($default_date !== '') { } elseif (!empty($default_date)) {
$timestamp = smarty_make_timestamp($default_date); $timestamp = smarty_make_timestamp($default_date);
} else { } else {
return; return;

View File

@@ -151,6 +151,7 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
$_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>"; $_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";
} }
} }
$compiler->template->compiled->has_nocache_code = true;
return $_output; return $_output;
} }
} }

View File

@@ -47,7 +47,7 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
new Smarty_Internal_ParseTree_Tag( new Smarty_Internal_ParseTree_Tag(
$compiler->parser, $compiler->parser,
$compiler->processNocacheCode( $compiler->processNocacheCode(
"<?php echo '{$output}';?>", "<?php echo '{$output}';?>\n",
true true
) )
) )
@@ -77,7 +77,7 @@ class Smarty_Internal_Compile_Private_Php extends Smarty_Internal_CompileBase
new Smarty_Internal_ParseTree_Tag( new Smarty_Internal_ParseTree_Tag(
$compiler->parser, $compiler->parser,
$compiler->processNocacheCode( $compiler->processNocacheCode(
"<?php echo '{$output}';?>", "<?php echo '{$output}';?>\n",
true true
) )
) )

View File

@@ -150,7 +150,7 @@ class Smarty_Internal_Runtime_Inheritance
return; return;
} }
// make sure we got child block of child template of current block // make sure we got child block of child template of current block
while ($block->child && $block->tplIndex <= $block->child->tplIndex) { while ($block->child && $block->child->child && $block->tplIndex <= $block->child->tplIndex) {
$block->child = $block->child->child; $block->child = $block->child->child;
} }
$this->process($tpl, $block); $this->process($tpl, $block);

View File

@@ -215,9 +215,23 @@ class Smarty_Internal_Templatelexer
*/ */
private $yy_global_pattern5 = null; private $yy_global_pattern5 = null;
private $_yy_state = 1; /**
* preg token pattern for text
*
* @var null
*/
private $yy_global_text = null;
private $_yy_stack = array(); /**
* preg token pattern for literal
*
* @var null
*/
private $yy_global_literal = null;
private $_yy_state = 1;
private $_yy_stack = array();
/** /**
* constructor * constructor
@@ -319,7 +333,7 @@ class Smarty_Internal_Templatelexer
{ {
if (!isset($this->yy_global_pattern1)) { if (!isset($this->yy_global_pattern1)) {
$this->yy_global_pattern1 = $this->yy_global_pattern1 =
$this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G((.*?)(?=((SMARTYldel)SMARTYal|[<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>]SMARTYliteral))|[\s\S]+)/isS"); $this->replace("/\G([{][}])|\G((SMARTYldel)SMARTYal[*])|\G((SMARTYldel)SMARTYalphp([ ].*?)?SMARTYrdel|(SMARTYldel)SMARTYal[\/]phpSMARTYrdel)|\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([<][?]((php\\s+|=)|\\s+)|[<][%]|[<][?]xml\\s+|[<]script\\s+language\\s*=\\s*[\"']?\\s*php\\s*[\"']?\\s*[>]|[?][>]|[%][>])|\G([\S\s])/isS");
} }
if (!isset($this->dataLength)) { if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data); $this->dataLength = strlen($this->data);
@@ -336,11 +350,8 @@ class Smarty_Internal_Templatelexer
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr( ' an empty string. Input "' . substr($this->data,
$this->data, $this->counter, 5) . '... state TEXT');
$this->counter,
5
) . '... state TEXT');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -379,6 +390,7 @@ class Smarty_Internal_Templatelexer
public function yy_r1_2() public function yy_r1_2()
{ {
$to = $this->dataLength;
preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", $this->data, $match, PREG_OFFSET_CAPTURE, preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", $this->data, $match, PREG_OFFSET_CAPTURE,
$this->counter); $this->counter);
if (isset($match[ 0 ][ 1 ])) { if (isset($match[ 0 ][ 1 ])) {
@@ -425,6 +437,16 @@ class Smarty_Internal_Templatelexer
public function yy_r1_19() public function yy_r1_19()
{ {
if (!isset($this->yy_global_text)) {
$this->yy_global_text =
$this->replace('/(SMARTYldel)SMARTYal|[<][?]((php\s+|=)|\s+)|[<][%]|[<][?]xml\s+|[<]script\s+language\s*=\s*["\']?\s*php\s*["\']?\s*[>]|[?][>]|[%][>]SMARTYliteral/isS');
}
$to = $this->dataLength;
preg_match($this->yy_global_text, $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
if (isset($match[ 0 ][ 1 ])) {
$to = $match[ 0 ][ 1 ];
}
$this->value = substr($this->data, $this->counter, $to - $this->counter);
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
@@ -449,11 +471,8 @@ class Smarty_Internal_Templatelexer
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr( ' an empty string. Input "' . substr($this->data,
$this->data, $this->counter, 5) . '... state TAG');
$this->counter,
5
) . '... state TAG');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -573,7 +592,7 @@ class Smarty_Internal_Templatelexer
{ {
if (!isset($this->yy_global_pattern3)) { if (!isset($this->yy_global_pattern3)) {
$this->yy_global_pattern3 = $this->yy_global_pattern3 =
$this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS"); $this->replace("/\G(\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*([!=][=]{1,2}|[<][=>]?|[>][=]?|[&|]{2})\\s*)|\G(\\s+(eq|ne|neq|gt|ge|gte|lt|le|lte|mod|and|or|xor)\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even|div)\\s+by\\s+)|\G(\\s+is\\s+(not\\s+)?(odd|even))|\G([!]\\s*|not\\s+)|\G([(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\\s*)|\G(\\s*[(]\\s*)|\G(\\s*[)])|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*[-][>]\\s*)|\G(\\s*[=][>]\\s*)|\G(\\s*[=]\\s*)|\G(([+]|[-]){2})|\G(\\s*([+]|[-])\\s*)|\G(\\s*([*]{1,2}|[%\/^&]|[<>]{2})\\s*)|\G([@])|\G(array\\s*[(]\\s*)|\G([#])|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*[=]\\s*)|\G(([0-9]*[a-zA-Z_]\\w*)?(\\\\[0-9]*[a-zA-Z_]\\w*)+)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G([`])|\G([|][@]?)|\G([.])|\G(\\s*[,]\\s*)|\G(\\s*[;]\\s*)|\G([:]{2})|\G(\\s*[:]\\s*)|\G(\\s*[?]\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G([\S\s])/isS");
} }
if (!isset($this->dataLength)) { if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data); $this->dataLength = strlen($this->data);
@@ -590,11 +609,8 @@ class Smarty_Internal_Templatelexer
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr( ' an empty string. Input "' . substr($this->data,
$this->data, $this->counter, 5) . '... state TAGBODY');
$this->counter,
5
) . '... state TAGBODY');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -772,10 +788,15 @@ class Smarty_Internal_Templatelexer
public function yy_r3_42() public function yy_r3_42()
{ {
$this->token = Smarty_Internal_Templateparser::TP_HATCH; $this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
} }
public function yy_r3_43() public function yy_r3_43()
{
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
}
public function yy_r3_44()
{ {
// 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->compiler->getRdelLength()) === if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->compiler->getRdelLength()) ===
@@ -788,73 +809,73 @@ class Smarty_Internal_Templatelexer
} }
} }
public function yy_r3_44() public function yy_r3_45()
{ {
$this->token = Smarty_Internal_Templateparser::TP_NAMESPACE; $this->token = Smarty_Internal_Templateparser::TP_NAMESPACE;
} }
public function yy_r3_47() public function yy_r3_48()
{ {
$this->token = Smarty_Internal_Templateparser::TP_ID; $this->token = Smarty_Internal_Templateparser::TP_ID;
} }
public function yy_r3_48() public function yy_r3_49()
{ {
$this->token = Smarty_Internal_Templateparser::TP_INTEGER; $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
} }
public function yy_r3_49() public function yy_r3_50()
{ {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
$this->yypopstate(); $this->yypopstate();
} }
public function yy_r3_50() public function yy_r3_51()
{ {
$this->token = Smarty_Internal_Templateparser::TP_VERT; $this->token = Smarty_Internal_Templateparser::TP_VERT;
} }
public function yy_r3_51() public function yy_r3_52()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOT; $this->token = Smarty_Internal_Templateparser::TP_DOT;
} }
public function yy_r3_52() public function yy_r3_53()
{ {
$this->token = Smarty_Internal_Templateparser::TP_COMMA; $this->token = Smarty_Internal_Templateparser::TP_COMMA;
} }
public function yy_r3_53() public function yy_r3_54()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON; $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
} }
public function yy_r3_54() public function yy_r3_55()
{ {
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON; $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
} }
public function yy_r3_55() public function yy_r3_56()
{ {
$this->token = Smarty_Internal_Templateparser::TP_COLON; $this->token = Smarty_Internal_Templateparser::TP_COLON;
} }
public function yy_r3_56() public function yy_r3_57()
{ {
$this->token = Smarty_Internal_Templateparser::TP_QMARK; $this->token = Smarty_Internal_Templateparser::TP_QMARK;
} }
public function yy_r3_57() public function yy_r3_58()
{ {
$this->token = Smarty_Internal_Templateparser::TP_HEX; $this->token = Smarty_Internal_Templateparser::TP_HEX;
} }
public function yy_r3_58() public function yy_r3_59()
{ {
$this->token = Smarty_Internal_Templateparser::TP_SPACE; $this->token = Smarty_Internal_Templateparser::TP_SPACE;
} // end function } // end function
public function yy_r3_59() public function yy_r3_60()
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
@@ -863,7 +884,7 @@ class Smarty_Internal_Templatelexer
{ {
if (!isset($this->yy_global_pattern4)) { if (!isset($this->yy_global_pattern4)) {
$this->yy_global_pattern4 = $this->yy_global_pattern4 =
$this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((.*?)(?=(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel))/isS"); $this->replace("/\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G([\S\s])/isS");
} }
if (!isset($this->dataLength)) { if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data); $this->dataLength = strlen($this->data);
@@ -880,11 +901,8 @@ class Smarty_Internal_Templatelexer
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr( ' an empty string. Input "' . substr($this->data,
$this->data, $this->counter, 5) . '... state LITERAL');
$this->counter,
5
) . '... state LITERAL');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -935,6 +953,17 @@ class Smarty_Internal_Templatelexer
public function yy_r4_5() public function yy_r4_5()
{ {
if (!isset($this->yy_global_literal)) {
$this->yy_global_literal = $this->replace('/(SMARTYldel)SMARTYal[\/]?literalSMARTYrdel/isS');
}
$to = $this->dataLength;
preg_match($this->yy_global_literal, $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
if (isset($match[ 0 ][ 1 ])) {
$to = $match[ 0 ][ 1 ];
} else {
$this->compiler->trigger_template_error("missing or misspelled literal closing tag");
}
$this->value = substr($this->data, $this->counter, $to - $this->counter);
$this->token = Smarty_Internal_Templateparser::TP_LITERAL; $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
} // end function } // end function
@@ -942,7 +971,7 @@ class Smarty_Internal_Templatelexer
{ {
if (!isset($this->yy_global_pattern5)) { if (!isset($this->yy_global_pattern5)) {
$this->yy_global_pattern5 = $this->yy_global_pattern5 =
$this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))/isS"); $this->replace("/\G((SMARTYldel)SMARTYautoliteral\\s+SMARTYliteral)|\G((SMARTYldel)SMARTYalliteral\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/]literal\\s*SMARTYrdel)|\G((SMARTYldel)SMARTYal[\/])|\G((SMARTYldel)SMARTYal[0-9]*[a-zA-Z_]\\w*)|\G((SMARTYldel)SMARTYal)|\G([\"])|\G([`][$])|\G([$][0-9]*[a-zA-Z_]\\w*)|\G([$])|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=((SMARTYldel)SMARTYal|\\$|`\\$|\"SMARTYliteral)))|\G([\S\s])/isS");
} }
if (!isset($this->dataLength)) { if (!isset($this->dataLength)) {
$this->dataLength = strlen($this->data); $this->dataLength = strlen($this->data);
@@ -959,11 +988,8 @@ class Smarty_Internal_Templatelexer
} }
if (empty($yymatches)) { if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' . throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr( ' an empty string. Input "' . substr($this->data,
$this->data, $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
$this->counter,
5
) . '... state DOUBLEQUOTEDSTRING');
} }
next($yymatches); // skip global match next($yymatches); // skip global match
$this->token = key($yymatches); // token number $this->token = key($yymatches); // token number
@@ -1057,4 +1083,13 @@ class Smarty_Internal_Templatelexer
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
public function yy_r5_22()
{
$to = $this->dataLength;
$this->value = substr($this->data, $this->counter, $to - $this->counter);
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
} }

File diff suppressed because it is too large Load Diff