fabpot/Twig — Issue #588: 'replace' filter buggy when array index is a variable
Author: tiagojsag
Created: 2012-01-09 13:13:02+00:00
State: open

Hi,
Since 1.5.0-RC1 twig supports expressions as hash keys (array indexes), so the following should be possible:
```
{% set criteria = 'news' %}

{{ text | replace({ criteria : ""~criteria~""}) | raw }}

```
this does not throw an error as it did in 1.4.x, but also nothing is modified in the output. If I use:
```

{{ text | replace({ 'news' : ""~criteria~""}) | raw }}

```
the output is the expected (instances of 'news' are highlighted)

cheers