Fix dynamic name (and filter!) validation accidentally applying to comments.

This commit is contained in:
Justin Hileman
2022-08-23 09:11:52 -04:00
parent 454b4c63e9
commit 53944831cf
+2
View File
@@ -86,6 +86,7 @@ class Mustache_Parser
$this->lineTokens = 0; $this->lineTokens = 0;
} }
if ($token[Mustache_Tokenizer::TYPE] !== Mustache_Tokenizer::T_COMMENT) {
if ($this->pragmaDynamicNames && isset($token[Mustache_Tokenizer::NAME])) { if ($this->pragmaDynamicNames && isset($token[Mustache_Tokenizer::NAME])) {
list($name, $isDynamic) = $this->getDynamicName($token); list($name, $isDynamic) = $this->getDynamicName($token);
if ($isDynamic) { if ($isDynamic) {
@@ -101,6 +102,7 @@ class Mustache_Parser
$token[Mustache_Tokenizer::FILTERS] = $filters; $token[Mustache_Tokenizer::FILTERS] = $filters;
} }
} }
}
switch ($token[Mustache_Tokenizer::TYPE]) { switch ($token[Mustache_Tokenizer::TYPE]) {
case Mustache_Tokenizer::T_DELIM_CHANGE: case Mustache_Tokenizer::T_DELIM_CHANGE: