Twig after update to v2.6.1 - Undefined index: var

2019-08-27 01:50发布

I get an error after updating twig

- Updating twig/twig (v2.6.0 => v2.6.1): 

In composer, I have:

"symfony/twig-bundle": "^4.1",

Error is:

twig/twig "Notice: Undefined index: vars"

In template:

{{ form.vars.id }}

If I put {{ dump(form) }}, I see +vars ...

标签: php twig
1条回答
你好瞎i
2楼-- · 2019-08-27 02:14

It's a (known) bug in twig v2.6.1 - https://github.com/twigphp/Twig/issues/2810

You can simply not update to that version for now, or explicitly mark it not to install until the next version has been released (it should be in the next day or two at most).

# Adding this line to composer.json will ensure that the version will not be installed.
"conflict": {
    "twig/twig": "2.6.1"
},

twig/twig v2.6.2 was released later the same day correcting the bug.

查看更多
登录 后发表回答