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
dist: precise
- php: 5.4
dist: precise
- php: 5.5
- php: 5.5
- php: 5.6
- php: 7.0
- 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).
However {{foo}} is not an literal but will be interpreted as a recursive Smarty tag.
If you use
$smarty->setLiteral(array('{{','}}'));
$smarty->setLiterals(array('{{','}}'));
{{foo}} is now a literal as well.
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.
B) Example 2
Assume your delimiter are '<-' , '->' and '<--' , '-->' shall be literals
$smarty->setLiteral(array('<--','-->'));
$smarty->setLiterals(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 =====
03.09.2018
- 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;
/**
* 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
*
@@ -324,14 +338,13 @@ class Smarty_Internal_Templatelexer
if = ~(if|elseif|else if|while)\s+~
for = ~for\s+~
makenocache = ~make_nocache\s+~
array = ~array~
foreach = ~foreach(?![^\s])~
setfilter = ~setfilter\s+~
instanceof = ~\s+instanceof\s+~
not = ~[!]\s*|not\s+~
typecast = ~[(](int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)[)]\s*~
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
%statename TEXT
@@ -339,7 +352,8 @@ class Smarty_Internal_Templatelexer
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
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])) {
$to = $match[0][1] + strlen($match[0][0]);
} else {
@@ -369,8 +383,17 @@ class Smarty_Internal_Templatelexer
phpstart {
$this->compiler->getTagCompiler('private_php')->parsePhp($this);
}
text {
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
char {
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
@@ -528,6 +551,9 @@ class Smarty_Internal_Templatelexer
at {
$this->token = Smarty_Internal_Templateparser::TP_AT;
}
array openP {
$this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
}
hatch {
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
}
@@ -601,8 +627,19 @@ class Smarty_Internal_Templatelexer
$this->yypopstate();
}
}
literaltext {
$this->token = Smarty_Internal_Templateparser::TP_LITERAL;
char {
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
@@ -648,7 +685,12 @@ class Smarty_Internal_Templatelexer
textdoublequoted {
$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.
%left COLON.
%left UNIMATH.
//
// complete template
@@ -633,16 +633,6 @@ expr(res) ::= expr(e) UNIMATH(m) value(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
// special conditions
expr(res) ::= expr(e1) tlop(c) value(e2). {
@@ -787,7 +777,10 @@ value(res) ::= NAMESPACE(c). {
res = c;
}
// array
value(res) ::= arraydef(a). {
res = a;
}
// static class access
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))) {
@@ -1109,6 +1102,9 @@ modparameters(res) ::= . {
modparameter(res) ::= COLON value(mp). {
res = array(mp);
}
modparameter(res) ::= COLON UNIMATH(m) value(mp). {
res = array(trim(m).mp);
}
modparameter(res) ::= COLON array(mp). {
res = array(mp);
@@ -1191,7 +1187,10 @@ scond(res) ::= SINGLECOND(o). {
//
// 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.')';
}

View File

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

View File

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

View File

@@ -41,9 +41,9 @@ function smarty_modifier_date_format($string, $format = null, $default_date = ''
}
$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);
} elseif ($default_date !== '') {
} elseif (!empty($default_date)) {
$timestamp = smarty_make_timestamp($default_date);
} else {
return;

View File

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

View File

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

View File

@@ -150,7 +150,7 @@ class Smarty_Internal_Runtime_Inheritance
return;
}
// 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;
}
$this->process($tpl, $block);

View File

@@ -215,9 +215,23 @@ class Smarty_Internal_Templatelexer
*/
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
@@ -319,7 +333,7 @@ class Smarty_Internal_Templatelexer
{
if (!isset($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)) {
$this->dataLength = strlen($this->data);
@@ -336,11 +350,8 @@ class Smarty_Internal_Templatelexer
}
if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state TEXT');
' an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state TEXT');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -379,6 +390,7 @@ class Smarty_Internal_Templatelexer
public function yy_r1_2()
{
$to = $this->dataLength;
preg_match("/[*]{$this->compiler->getRdelPreg()}[\n]?/", $this->data, $match, PREG_OFFSET_CAPTURE,
$this->counter);
if (isset($match[ 0 ][ 1 ])) {
@@ -425,6 +437,16 @@ class Smarty_Internal_Templatelexer
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;
}
@@ -449,11 +471,8 @@ class Smarty_Internal_Templatelexer
}
if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state TAG');
' an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state TAG');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -573,7 +592,7 @@ class Smarty_Internal_Templatelexer
{
if (!isset($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)) {
$this->dataLength = strlen($this->data);
@@ -590,11 +609,8 @@ class Smarty_Internal_Templatelexer
}
if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state TAGBODY');
' an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state TAGBODY');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -772,10 +788,15 @@ class Smarty_Internal_Templatelexer
public function yy_r3_42()
{
$this->token = Smarty_Internal_Templateparser::TP_HATCH;
$this->token = Smarty_Internal_Templateparser::TP_ARRAYOPEN;
}
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 '='
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;
}
public function yy_r3_47()
public function yy_r3_48()
{
$this->token = Smarty_Internal_Templateparser::TP_ID;
}
public function yy_r3_48()
public function yy_r3_49()
{
$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->yypopstate();
}
public function yy_r3_50()
public function yy_r3_51()
{
$this->token = Smarty_Internal_Templateparser::TP_VERT;
}
public function yy_r3_51()
public function yy_r3_52()
{
$this->token = Smarty_Internal_Templateparser::TP_DOT;
}
public function yy_r3_52()
public function yy_r3_53()
{
$this->token = Smarty_Internal_Templateparser::TP_COMMA;
}
public function yy_r3_53()
public function yy_r3_54()
{
$this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
}
public function yy_r3_54()
public function yy_r3_55()
{
$this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
}
public function yy_r3_55()
public function yy_r3_56()
{
$this->token = Smarty_Internal_Templateparser::TP_COLON;
}
public function yy_r3_56()
public function yy_r3_57()
{
$this->token = Smarty_Internal_Templateparser::TP_QMARK;
}
public function yy_r3_57()
public function yy_r3_58()
{
$this->token = Smarty_Internal_Templateparser::TP_HEX;
}
public function yy_r3_58()
public function yy_r3_59()
{
$this->token = Smarty_Internal_Templateparser::TP_SPACE;
} // end function
public function yy_r3_59()
public function yy_r3_60()
{
$this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
@@ -863,7 +884,7 @@ class Smarty_Internal_Templatelexer
{
if (!isset($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)) {
$this->dataLength = strlen($this->data);
@@ -880,11 +901,8 @@ class Smarty_Internal_Templatelexer
}
if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state LITERAL');
' an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state LITERAL');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -935,6 +953,17 @@ class Smarty_Internal_Templatelexer
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;
} // end function
@@ -942,7 +971,7 @@ class Smarty_Internal_Templatelexer
{
if (!isset($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)) {
$this->dataLength = strlen($this->data);
@@ -959,11 +988,8 @@ class Smarty_Internal_Templatelexer
}
if (empty($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
' an empty string. Input "' . substr(
$this->data,
$this->counter,
5
) . '... state DOUBLEQUOTEDSTRING');
' an empty string. Input "' . substr($this->data,
$this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
@@ -1057,4 +1083,13 @@ class Smarty_Internal_Templatelexer
{
$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