Add conditional to check if section

This was causing an issue when the section name was also used as a
variable in the block. When walking back up the block to find the open
tag, because it only checked if the name matched, the parser would
see the variable usage as the opening block and drop the rest of the
block. This checks explicitly whether it's a section or inverted block
before doing the left/right trim logic.
This commit is contained in:
mAAdhaTTah 2016-12-12 08:05:58 -05:00
parent 7aad4f30e3
commit c25b7ee150

View File

@ -87,6 +87,8 @@ class Parser
if (!array_key_exists(Tokenizer::NODES, $result) if (!array_key_exists(Tokenizer::NODES, $result)
&& isset($result[Tokenizer::NAME]) && isset($result[Tokenizer::NAME])
&& ($result[Tokenizer::TYPE] == Tokenizer::T_SECTION
|| $result[Tokenizer::TYPE] == Tokenizer::T_INVERTED)
&& $result[Tokenizer::NAME] == $token[Tokenizer::NAME] && $result[Tokenizer::NAME] == $token[Tokenizer::NAME]
) { ) {
if (isset($result[Tokenizer::TRIM_RIGHT]) if (isset($result[Tokenizer::TRIM_RIGHT])