From 8ecde472033468efe0149eee53043cfb4fdc6121 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Sun, 16 Jun 2024 21:48:14 +0200 Subject: [PATCH] fixed error when using section with nocache. Fixes #1034 --- changelog/1034.md | 1 + src/Compile/Tag/Section.php | 2 +- src/Compile/Tag/SectionClose.php | 2 +- .../TemplateSource/TagTests/Section/CompileSectionTest.php | 6 ++++++ 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelog/1034.md diff --git a/changelog/1034.md b/changelog/1034.md new file mode 100644 index 000000000..1c14a8608 --- /dev/null +++ b/changelog/1034.md @@ -0,0 +1 @@ +- Fixed error when using section with nocache [#1034](https://github.com/smarty-php/smarty/issues/1034) \ No newline at end of file diff --git a/src/Compile/Tag/Section.php b/src/Compile/Tag/Section.php index f82ac4211..136591174 100644 --- a/src/Compile/Tag/Section.php +++ b/src/Compile/Tag/Section.php @@ -99,7 +99,7 @@ public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = 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]); diff --git a/src/Compile/Tag/SectionClose.php b/src/Compile/Tag/SectionClose.php index efab60975..24c79c32a 100644 --- a/src/Compile/Tag/SectionClose.php +++ b/src/Compile/Tag/SectionClose.php @@ -33,7 +33,7 @@ public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = if ($nocache_pushed) { // pop the pushed virtual nocache tag - $this->closeTag('nocache'); + $this->closeTag($compiler, 'nocache'); } $output = "assertEquals('', $this->smarty->fetch($source)); + } + }