Fix inhertiance implementation for $smarty.block.child

This commit is contained in:
Simon Wisselink
2023-01-23 08:47:49 +01:00
parent 4bbe94f4e0
commit 7c02bb9a63
2 changed files with 7 additions and 2 deletions

View File

@@ -76,6 +76,7 @@ class BlockCompiler extends Base {
$compiler->getParser()->lex->taglineno
);
}
$compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]['callsChild'] = true;
$compiler->has_code = true;
$compiler->suppressNocacheProcessing = true;

View File

@@ -22,12 +22,16 @@ class BlockClose extends Inheritance {
{
[$_attr, $_nocache, $_buffer, $_has_nocache_code, $_className] = $this->closeTag($compiler, ['block']);
$_block = [];
if (isset($compiler->_cache['blockParams'])) {
$_block = $compiler->_cache['blockParams'][$compiler->_cache['blockNesting']] ?? [];
unset($compiler->_cache['blockParams'][$compiler->_cache['blockNesting']]);
}
$_name = $_attr['name'];
$_assign = $_attr['assign'] ?? null;
unset($_attr[ 'assign' ], $_attr[ 'name' ]);
$_block = [];
foreach ($_attr as $name => $stat) {
if ((is_bool($stat) && $stat !== false) || (!is_bool($stat) && $stat !== 'false')) {
$_block[ $name ] = 'true';