From 7c02bb9a632d983d14f1e40c60fc550d48bf4141 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Mon, 23 Jan 2023 08:47:49 +0100 Subject: [PATCH] Fix inhertiance implementation for $smarty.block.child --- src/Compile/BlockCompiler.php | 1 + src/Compile/Tag/BlockClose.php | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Compile/BlockCompiler.php b/src/Compile/BlockCompiler.php index 0807f077..089e618d 100644 --- a/src/Compile/BlockCompiler.php +++ b/src/Compile/BlockCompiler.php @@ -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; diff --git a/src/Compile/Tag/BlockClose.php b/src/Compile/Tag/BlockClose.php index b67777f0..7dc9c60d 100644 --- a/src/Compile/Tag/BlockClose.php +++ b/src/Compile/Tag/BlockClose.php @@ -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';