From bed0be33495c3200c05a44f1ead864668fe5b61e 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 c7e7ef7398..c4bab14150 100644 --- a/src/Latte/Macros/BlockMacros.php +++ b/src/Latte/Macros/BlockMacros.php @@ -226,6 +226,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['id'])) { + throw new CompileException('Cannot combine HTML attribute id with n:snippet.'); + } + for ( $parent = $node->parentNode; $parent && !($parent->name === 'snippet' || $parent->name === 'snippetArea');