Fix usage of display_end hook

This commit is contained in:
Fabien Potencier
2024-04-17 08:50:46 -04:00
parent 2d169bdca2
commit 3ca9685f58
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# 3.9.2 (2024-XX-XX)
* n/a
* Fix usage of display_end hook
# 3.9.1 (2024-04-17)
+5 -2
View File
@@ -336,12 +336,15 @@ final class ModuleNode extends Node
$compiler->raw('$this->getParent($context)');
}
$compiler->raw("->unwrap()->yield(\$context, array_merge(\$this->blocks, \$blocks));\n");
} else {
}
$compiler->subcompile($this->getNode('display_end'));
if (!$this->hasNode('parent')) {
$compiler->write("return; yield '';\n"); // ensure at least one yield call even for templates with no output
}
$compiler
->subcompile($this->getNode('display_end'))
->outdent()
->write("}\n\n")
;