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(...)""
This commit is contained in:
uwetews
2018-10-09 03:36:14 +02:00
parent 9301ba4bfc
commit 7f531f6a44
5 changed files with 44 additions and 31 deletions

View File

@@ -1,4 +1,9 @@
===== 3.1.34-dev-1 =====
===== 3.1.34-dev-2 =====
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

View File

@@ -338,6 +338,7 @@ 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+~
@@ -550,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;
}

View File

@@ -226,7 +226,7 @@ class Smarty_Internal_Templateparser
%right VERT.
%left COLON.
%left UNIMATH.
//
// complete template
@@ -632,16 +632,6 @@ expr(res) ::= expr(e) MATH(m) value(v). {
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
@@ -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

@@ -112,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.34-dev-1';
const SMARTY_VERSION = '3.1.34-dev-2';
/**
* define variable scopes
*/

View File

@@ -592,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);
@@ -788,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()) ===
@@ -804,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;
}