Issue Bug Closed

#104363Fluid Template Variable Parsing Error with Spaces around Operators

Julian Haas 07/11/24, 11:58 updated 07/11/24, 19:45

Description

Steps to Reproduce:

  1. Use the following Fluid template code:
testVar: {testVar} <br/>
A: {testVar - 1} <br/>
B: {testVar - 1 } <br/>
C: {testVar-1} <br/>
D: {testVar + 1} <br/>
E: {testVar + 1 } <br/>
F: {testVar+1} <br/>
  1. Set testVar to any integer, e.g., 2.

Expected Output:

testVar: 2
A: 1
B: 1
C: 1
D: 3
E: 3
F: 3

Actual Output:

testVar: 2
A: 1
B: {testVar - 1 }
C:
D: 3
E: {testVar + 1 }
F: 3

Analysis:

  • The expression {testVar – 1} and {testVar + 1} are parsed correctly when there are spaces around the operator.
  • {testVar – 1 } and {testVar + 1 } result in no evaluation and return the expression as a string.
  • {testVar+1} without space is parsed and evaluated correctly.
  • {testVar-1} without space is not parsed and evaluated correctly.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 1

  1. Garvin Hicking commented and changed status New Closed 07/11/24, 19:45

    Thanks for the report! The fluid parsing engine is actually an external dependency and seperately maintained. I took the liberty to file your bug there:

    https://github.com/TYPO3/Fluid/issues/895

    and close it here. Hope that’s fine by you! :)