- unclosed block tag in double quted string must throw compiler exception.

https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392
This commit is contained in:
Uwe Tews
2017-10-12 20:15:42 +02:00
parent b271173a2d
commit 6b97d5cdd5
7 changed files with 502 additions and 606 deletions

View File

@@ -2,6 +2,8 @@
12.10.2017 12.10.2017
- bugfix $smarty.block.child and $smarty.block.parent could not be used like any - bugfix $smarty.block.child and $smarty.block.parent could not be used like any
$smarty special variable https://github.com/smarty-php/smarty/issues/393 $smarty special variable https://github.com/smarty-php/smarty/issues/393
- unclosed block tag in double quoted string must throw compiler exception.
https://github.com/smarty-php/smarty/issues/391 https://github.com/smarty-php/smarty/issues/392
07.10.2017 07.10.2017
- bugfix modification of 9.8.2017 did fail on some recursive - bugfix modification of 9.8.2017 did fail on some recursive

View File

@@ -510,6 +510,7 @@ class Smarty_Internal_Templatelexer
double_quote { double_quote {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING); $this->yypushstate(self::DOUBLEQUOTEDSTRING);
$this->compiler->enterDoubleQuote();
} }
singlequotestring { singlequotestring {
$this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING; $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
@@ -693,6 +694,7 @@ class Smarty_Internal_Templatelexer
double_quote { double_quote {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypopstate(); $this->yypopstate();
$this->compiler->leaveDoubleQuote();
} }
backtick dollar { backtick dollar {
$this->token = Smarty_Internal_Templateparser::TP_BACKTICK; $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;

View File

@@ -135,7 +135,7 @@ class Smarty_Internal_Templateparser
public $template_prefix = array(); public $template_prefix = array();
/** /**
* security object * template prefix array
* *
* @var \Smarty_Internal_ParseTree[] * @var \Smarty_Internal_ParseTree[]
*/ */

View File

@@ -108,7 +108,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.32-dev-24'; const SMARTY_VERSION = '3.1.32-dev-25';
/** /**
* define variable scopes * define variable scopes

File diff suppressed because it is too large Load Diff

View File

@@ -260,7 +260,6 @@ class Smarty_Internal_Templatelexer
$literals[ $key ] = preg_quote($literal, '/'); $literals[ $key ] = preg_quote($literal, '/');
} }
} }
if ($this->smarty->auto_literal) { if ($this->smarty->auto_literal) {
$literals[] = $this->ldel . '{1,}\\s+'; $literals[] = $this->ldel . '{1,}\\s+';
} }
@@ -374,7 +373,6 @@ class Smarty_Internal_Templatelexer
if ($this->counter >= $this->dataLength) { if ($this->counter >= $this->dataLength) {
return false; // end of input return false; // end of input
} }
do { do {
if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) { if (preg_match($this->yy_global_pattern1, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) { if (!isset($yymatches[ 0 ][ 1 ])) {
@@ -485,7 +483,6 @@ class Smarty_Internal_Templatelexer
if ($this->counter >= $this->dataLength) { if ($this->counter >= $this->dataLength) {
return false; // end of input return false; // end of input
} }
do { do {
if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) { if (preg_match($this->yy_global_pattern2, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) { if (!isset($yymatches[ 0 ][ 1 ])) {
@@ -618,7 +615,6 @@ class Smarty_Internal_Templatelexer
if ($this->counter >= $this->dataLength) { if ($this->counter >= $this->dataLength) {
return false; // end of input return false; // end of input
} }
do { do {
if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) { if (preg_match($this->yy_global_pattern3, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) { if (!isset($yymatches[ 0 ][ 1 ])) {
@@ -678,6 +674,7 @@ class Smarty_Internal_Templatelexer
{ {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypushstate(self::DOUBLEQUOTEDSTRING); $this->yypushstate(self::DOUBLEQUOTEDSTRING);
$this->compiler->enterDoubleQuote();
} }
function yy_r3_4() function yy_r3_4()
@@ -906,7 +903,6 @@ class Smarty_Internal_Templatelexer
if ($this->counter >= $this->dataLength) { if ($this->counter >= $this->dataLength) {
return false; // end of input return false; // end of input
} }
do { do {
if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) { if (preg_match($this->yy_global_pattern4, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) { if (!isset($yymatches[ 0 ][ 1 ])) {
@@ -989,7 +985,6 @@ class Smarty_Internal_Templatelexer
if ($this->counter >= $this->dataLength) { if ($this->counter >= $this->dataLength) {
return false; // end of input return false; // end of input
} }
do { do {
if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) { if (preg_match($this->yy_global_pattern5, $this->data, $yymatches, 0, $this->counter)) {
if (!isset($yymatches[ 0 ][ 1 ])) { if (!isset($yymatches[ 0 ][ 1 ])) {
@@ -1071,6 +1066,7 @@ class Smarty_Internal_Templatelexer
{ {
$this->token = Smarty_Internal_Templateparser::TP_QUOTE; $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
$this->yypopstate(); $this->yypopstate();
$this->compiler->leaveDoubleQuote();
} }
function yy_r5_8() function yy_r5_8()
@@ -1095,7 +1091,6 @@ class Smarty_Internal_Templatelexer
{ {
$this->token = Smarty_Internal_Templateparser::TP_TEXT; $this->token = Smarty_Internal_Templateparser::TP_TEXT;
} }
} }

File diff suppressed because it is too large Load Diff