fixed error when using section with nocache.

Fixes #1034
This commit is contained in:
Simon Wisselink
2024-06-16 21:48:14 +02:00
parent b978cb348e
commit 8ecde47203
4 changed files with 9 additions and 2 deletions

1
changelog/1034.md Normal file
View File

@@ -0,0 +1 @@
- Fixed error when using section with nocache [#1034](https://github.com/smarty-php/smarty/issues/1034)

View File

@@ -99,7 +99,7 @@ class Section extends ForeachSection {
if ($compiler->tag_nocache) {
// push a {nocache} tag onto the stack to prevent caching of this block
$this->openTag('nocache');
$this->openTag($compiler, 'nocache');
}
$this->openTag($compiler, 'section', ['section', $compiler->tag_nocache]);

View File

@@ -33,7 +33,7 @@ class SectionClose extends Base {
if ($nocache_pushed) {
// pop the pushed virtual nocache tag
$this->closeTag('nocache');
$this->closeTag($compiler, 'nocache');
}
$output = "<?php\n";

View File

@@ -148,4 +148,10 @@ class CompileSectionTest extends PHPUnit_Smarty
);
}
public function testSectionWithNocache()
{
$source = 'string:{section name=module start=0 loop=1 nocache}{/section}';
$this->assertEquals('', $this->smarty->fetch($source));
}
}