smarty-php / smarty

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
Other
2.25k stars 708 forks source link

Smarty v5 Error: {section} Tag First Argument Type Mismatch when opening and closing tag on NoCache #1034

Closed Khem closed 3 months ago

Khem commented 3 months ago

Error: Smarty\Compile\Base::openTag(): Argument #1 ($compiler) must be of type Smarty\Compiler\Template, string given, called in /var/www/html/vendor/smarty/smarty/src/Compile/Tag/Section.php on line 102.

We have a string passed on $this->openTag('nocache') but expects Template $compiler. Must be the same situation when closing the tag.

Thanks

wisskid commented 3 months ago

Do you have an example of the Smarty code that triggers this error?

Khem commented 3 months ago

Thanks for the reply @wisskid

we can produce the error by {section name=sectionname start=0 loop=1 nocache}

In our codebase we have {section name=sectionname start=0 loop=$loop}` where loop is dynamic.

wisskid commented 3 months ago

@Khem thanx for your report. The issue has been fixed and released in v5.3.1.