我正在使用Symfony 2.3并在我的与Twig相关的探查器中发布了弃用警告.如:
DEPRECATION - Using "replace" with character by character replacement is deprecated
and will be removed in Twig 2.0
Run Code Online (Sandbox Code Playgroud)
而|replace标签似乎仍树枝文档的一部分,所以我对如何处理这个警告有点困惑.
此外,我从我使用的第三方捆绑包中获得了类似的弃用警告.
您需要更改传递参数以更换twig中的函数的方式:
在它是两个参数之前,现在它是一个数组.
您可以在代码源中检查它不是替换twig_replace_filter函数,但是只有一种方法是调用它:https://github.com/twigphp/Twig/blob/1.x/lib/Twig/Extension/Core .PHP#L534
请注意,twig doc显示正确的示例:http: //twig.sensiolabs.org/doc/filters/replace.html