From 6217c69fb1db0ed621b1ef2c29e0f75e4039c21b Mon Sep 17 00:00:00 2001 From: messju Date: Thu, 12 Aug 2004 21:07:24 +0000 Subject: [PATCH] fixed occasional wrong error messages on mismatched tags when {else}, {elseif}, {foreachelse} or {sectionelse} is involved thanks to Ooypunk for pointing me on this --- NEWS | 2 ++ libs/Smarty_Compiler.class.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 918ff3e9..e2d0cd0b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - fix occasional wrong error messages on mismatched tags when + {else}, {elseif}, {foreachelse} or {sectionelse} is involved (messju) - fix handling of methods arguments (messju, Manfred Wischin) - remove touch() call that made the compiled-template's timestamp the same as the source-template's one. (messju) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index b7367719..4ca477db 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -2205,12 +2205,17 @@ class Smarty_Compiler extends Smarty { return $this->_pop_tag($close_tag); } if ($close_tag == 'section' && $_open_tag == 'sectionelse') { - $this->_pop_tag($close_tag); - return $_open_tag; + return $this->_pop_tag($close_tag); } if ($close_tag == 'foreach' && $_open_tag == 'foreachelse') { - $this->_pop_tag($close_tag); - return $_open_tag; + return $this->_pop_tag($close_tag); + } + if ($_open_tag == 'else' || $_open_tag == 'elseif') { + $_open_tag = 'if'; + } elseif ($_open_tag == 'sectionelse') { + $_open_tag = 'section'; + } elseif ($_open_tag == 'foreachelse') { + $_open_tag = 'foreach'; } $message = " expected {/$_open_tag} (opened line $_line_no)."; }