twig.js icon indicating copy to clipboard operation
twig.js copied to clipboard

TwigException: Twig.expression.type.array.start cannot follow a Twig.expression.type.variable at template:5 near '[...'

Open m-abs opened this issue 12 years ago • 4 comments
trafficstars

From twig.php: test/Twig/Tests/Fixtures/expressions/array_call.test

Template:

{{ items[items[foo]] }}

Data:

{ foo: 'bar', items: { foo: 'bar', bar: 'foo' } }

Error thrown:

TwigException: Twig.expression.type.array.start cannot follow a Twig.expression.type.variable at template:5 near '[...'

m-abs avatar Apr 29 '13 12:04 m-abs

any chance to have this fix?

alex-shatalov avatar Jun 29 '18 10:06 alex-shatalov

I don't use Twig.js anymore, so I can't help. Unsubscribing to this issue.

m-abs avatar Jun 29 '18 12:06 m-abs

I'm looking into this, but my initial analysis shows that this requires a fairly large structural change to handle the situation laid out here so it may take awhile before a fix is ready.

willrowe avatar Jul 02 '18 14:07 willrowe

Anyone stumbling on this, there's the following workaround:

{% set temp = items[foo] %}{{ items[temp] }}

anderium avatar Sep 04 '21 22:09 anderium