Paul Taylor
Paul Taylor

Reputation: 149

Symfony 2.7.4 twig error

I have just upgraded to Symfony 2.7.4 from 2.7.3. After the upgrade a form that worked under 2.7.3 is now throwing this error

An exception has been thrown during the compilation of a template ("Notice:   Undefined variable: test")

There is no variable in the template named 'test'.

The exception also shows this code snippet:

    if ($function instanceof Twig_SimpleFunction && $function->isDeprecated()) {
        $message = sprintf('Twig Function "%s" is deprecated', $function->getName());
        if ($test->getAlternative()) {
            $message .= sprintf('. Use "%s" instead', $function->getAlternative());
        }
        $message .= sprintf(' in %s at line %d.', $this->parser->getFilename(), $line);

This snippet suggests that twig is testing for a deprecated function and, if true, Symfony is objecting to an undefined variable $test.

Has anyone experienced this error or can give advise on how to resolve? Could this error be caused indirectly by something else in the form?

Upvotes: 2

Views: 353

Answers (1)

David Marko
David Marko

Reputation: 2519

You should upgrade to Twig 1.21.2 see http://symfony.com/blog/twig-1-21-2-released

Upvotes: 2

Related Questions