我刚刚从 Symfony 2.7.3 升级到 2.7.4。 升级后,在 2.7.3 下工作的表单现在抛出此错误
An exception has been thrown during the compilation of a template ("Notice: Undefined variable: test")
模板中没有名为“test”的变量。
异常还显示此代码片段:
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);
此代码片段表明 twig 正在测试已弃用的函数,如果属实,Symfony 会反对 undefined variable $test。
有人遇到过这个错误或者可以提供如何解决的建议吗? 此错误是否是由表单中的其他内容间接引起的?
最佳答案
您应该升级到 Twig 1.21.2,请参阅 http://symfony.com/blog/twig-1-21-2-released
关于php - Symfony 2.7.4 Twig 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32470687/