Skip to content

Commit

Permalink
BlockMacros: fixed expandTokens in dynamic blocks (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 authored and dg committed Jul 5, 2016
1 parent 2c45c38 commit 8815314
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Latte/Macros/BlockMacros.php
Expand Up @@ -351,7 +351,7 @@ public function macroBlockEnd(MacroNode $node, PhpWriter $writer)
$node->content = rtrim($node->content, " \t");
$this->getCompiler()->addMethod(
$node->data->func,
"extract(\$_args);\n?>$node->content<?php",
$this->getCompiler()->expandTokens("extract(\$_args);\n?>$node->content<?php"),
'$_args'
);
$node->content = '';
Expand Down
2 changes: 1 addition & 1 deletion tests/Latte/BlockMacros.dynamicblock.phpt
Expand Up @@ -33,7 +33,7 @@ $template = <<<'EOD'
{include #$name . '', var => 40}
{block word$name}{/block}
{block word$name}<div n:if="false"></div>{/block}
{block "word$name"}{/block}
EOD;
Expand Down
3 changes: 3 additions & 0 deletions tests/Latte/expected/BlockMacros.dynamicblock.phtml
Expand Up @@ -88,6 +88,9 @@ class Template%a% extends Latte\Runtime\Template
function blockWord_name($_args)
{
extract($_args);
if (false) {
?><div></div><?php
}

}

Expand Down

0 comments on commit 8815314

Please sign in to comment.