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)."; }