This question already has an answer here:
-
“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
28 answers
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 ...
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.