From 9a457acea62b8850122f1974bf68ccbb85ea6d99 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Fri, 3 Jan 2020 23:08:17 +0100 Subject: [PATCH] BlockMacros: check when dynamic snippet is combined with id attribute [Closes nette/application#242] --- src/Latte/Macros/BlockMacros.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Latte/Macros/BlockMacros.php b/src/Latte/Macros/BlockMacros.php index abb729653..57976aea5 100644 --- a/src/Latte/Macros/BlockMacros.php +++ b/src/Latte/Macros/BlockMacros.php @@ -229,6 +229,10 @@ public function macroBlock(MacroNode $node, PhpWriter $writer) } elseif (strpos($name, '$') !== false) { // dynamic block/snippet if ($node->name === 'snippet') { + if ($node->prefix && isset($node->htmlNode->attrs[$this->snippetAttribute])) { + throw new CompileException("Cannot combine HTML attribute $this->snippetAttribute with n:snippet."); + } + for ( $parent = $node->parentNode; $parent && !($parent->name === 'snippet' || $parent->name === 'snippetArea');