Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

twig deprecated twigfilter / enviroment.php simplefilter messages 20+ #3348

Closed
devouk opened this issue May 5, 2021 · 5 comments
Closed

Comments

@devouk
Copy link

devouk commented May 5, 2021

Hi running grav from the latest 7.14 build and looking at the error / warnings it is producing with php debugger first and then clockwork but there is 20+ occurrences of this same error in regards to twigs enviroment.php !

Using an instance of "Twig\TwigFunction" for filter "21" is deprecated since version 1.21. Use \Twig_SimpleFilter instead.

R:\grav\vendor\twig\twig\src\Environment.php

So after a bit of digging found this link

https://twig.symfony.com/doc/1.x/deprecated.html

Filters
As of Twig 1.x, use \Twig\TwigFilter to add a filter. The following classes and interfaces will be removed in 2.0:

Twig_FilterInterface
Twig_FilterCallableInterface
Twig_Filter
Twig_Filter_Function
Twig_Filter_Method
Twig_Filter_Node

As of Twig 2.x, the Twig_SimpleFilter class is deprecated and will be removed in Twig 3.x (use \Twig\TwigFilter instead). In Twig 2.x, Twig_SimpleFilter is just an alias for \Twig\TwigFilter.

Is this just a silly error version < 1.21 used TwigFilter =>1.21 /2 started to use Twig_Simplefilter then it has been now reverted back to TwigFilter with an alias.

If the alias exists and now it doesn't seemed to be too bothered about Twig\TwigFilter then there should be peace in the world.

Is it more of a warning or something that should be identified or addressed ? or is it just over zealous depreciated warning messages which can't figure out what is what !

@mahagr
Copy link
Member

mahagr commented May 6, 2021

In order to support Twig 3, namespaced classes should be used. I have no idea why they would have added deprecation messages for something that is used in later version...

@devouk
Copy link
Author

devouk commented May 6, 2021

Thanks for the reply @mahagr , so this isn't something I shouldn't / do not need to worry about? Or do I need to do something to correct the issue.

Just for clarification what is the default version of twig which is being used to grav ? Presume it is version 1.21 in the standard release build. Do I need to update it to twig 2/3 ?

Thank you for any clarification :)

@mahagr
Copy link
Member

mahagr commented May 6, 2021

Umm, after some investigation this was a "bug", which will be fixed for the next version. You can safely ignore any deprecation messages unless you're developing a plugin and want to support the next version of Grav with a minimal number of changes.

@mahagr
Copy link
Member

mahagr commented May 6, 2021

And no, we want to move on from Twig 1 to Twig 3.

@devouk
Copy link
Author

devouk commented May 6, 2021

Thanks for your help :) Have a good day :)

@devouk devouk closed this as completed May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants