I’m trying to upgrade a Symfony instance from 2.8 to 3.0, and, while I was checking the deprecations in profiler, I found:
The TwigTemplate class implements Twig_TemplateInterface that is deprecated since 1.12 (to be removed in 3.0) (2 times) The TwigLexer class implements Twig_LexerInterface that is deprecated since 1.12 (to be removed in 3.0) The TwigCompiler class implements Twig_CompilerInterface that is deprecated since 1.12 (to be removed in 3.0) The TwigNodeNode class implements Twig_NodeInterface that is deprecated since 1.12 (to be removed in 3.0) The TwigParser class implements Twig_ParserInterface that is deprecated since 1.12 (to be removed in 3.0)
My Twig version is 1.42.4
Just to confirm: we agree this is deprecation messages from twig itself, telling it will remove those functions in its own 3.0 version ? I mean: it’s not Symfony telling it will not support this anymore in its 3.0.0 ?
I also suppose upgrading Twig will not help on this. It is the the responsible for those calls I guess 😉
After confirming the above basics, how can I locate the bundle which uses those deprecated functions, because I suppose THIS is the package I need to upgrade first (I’m pretty sure the problem is not in my own code…) ?
The message does not give so many details, and… the stack is just unclear to me…
DebugClassLoader::loadClass() spl_autoload_call() class_exists() (called from Template.php at line 5) require() (called from DebugClassLoader.php at line 169) DebugClassLoader::loadClass() spl_autoload_call() ReflectionClass::__construct() (called from ClassCollectionLoader.php at line 307) ClassCollectionLoader::getOrderedClasses() (called from ClassCollectionLoader.php at line 120) ClassCollectionLoader::load() (called from Kernel.php at line 405) Kernel::doLoadClassCache() (called from Kernel.php at line 124) Kernel::boot() (called from Kernel.php at line 180) Kernel::handle() (called from app_dev.php at line 28)
Maybe that can help to answer: I noticed the deprecation warnings appear ONLY when I load a page for the first time, or when I just deleted the cache… So, it’s something generating the Symfony cache, which is calling deprecated features…
- At last, but not least, I tried to upgrade Twig from 1.x to 2.x, knowing Symfony composer tells “twig/twig”: “^1.0||^2.0”. I first though it would go to 2.x, but it just upgraded it to the lmatest 1.x (1.42.4), my current version… Composer message was not clear about what was reponsible of the fact it did not go higher…
IF I understood well, those deprecation warnings are not about Symfony upgrade itself, so I ‘could eventually go for it. I have something in my instance, that uses old Twig functions, so I would like to get rid of it…
BONUS question: sometimes, I wonder… it’s so complicated to fight with all those version constraints… Wouldn’t it be more simple just to use generic composer.json, provided with the symfony version we are trying to reach, instead of editing the one we get for years, in our old version ? At least, I guess all libraries would be updated at versions tested by developpers ?
Thanks for helping, and happy new year 😉
Source: Symfony Questions