mirror of
https://github.com/Mibew/handlebars.php.git
synced 2024-11-15 08:44:12 +03:00
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:
parent
7aad4f30e3
commit
c25b7ee150
@ -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])
|
||||||
|
Loading…
Reference in New Issue
Block a user