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
Fix bugs with latest plugin release 1.21.0 #2658
Conversation
|
@mrfsrf This installs Twig version 2, if you install Timber through Composer and the requirements are met. We’ve always allowed installing Twig version 2 this way. For the plugin version of Timber, we explicitly request Twig 1.44.7, because we need to stay on version 1 for compatibility: timber/bin/deploy-to-wp-org.sh Lines 16 to 17 in 3667a17
Timber v2 will allow you to install Twig 2 or 3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, this example shows we should always run tests against the entire dependency range: meaning that prefer-lowest
should be part of the matrix (for 2.x too).
Yes, definitely! |
Thanks so much @gchtr and @nlemoine. I was writing a long question about the 8.1 and the failing test, I see the notes in |
otherwise, twig 3 is installed (as it's > than 1.44.7) |
Resolves:
Issue
When the plugin version 1.21.0 of Timber was released, we accidentally included Twig 2.15.3 instead of Twig 1.44.7. This caused a lot of bugs for sites that auto-updated the Timber plugin (not recommended). We deactivated the 1.21.0 as the default release to disable that version from being found by auto-updates.
Solution
As a solution, this pull request makes sure that Twig version 1.44.7 is used when deploying the plugin version of Timber. When Timber is installed through Composer, the 2.x will still be installed.
We also added a new test configuration that tests PHP 8.0 and PHP 8.1 with version 1.44.7 of Twig by using
prefer-lowest
when installing Composer dependencies (thanks @nlemoine).Unfortunately, I didn’t manage to get this fully working with PHP 8.1. A deprecation warning is somehow caught as content in the output in a shortcode test. I couldn’t find out how to "only" raise a PHP Deprecation warning. Does anybody have some ideas?
That’s why I’m hesitant about officially supporting PHP 8.1 in version Timber 1.x in the plugin version.
Impact
This pull request should fix the errors that people are seeing because we will revert to Twig 1.44.7:
Uncaught TypeError: Argument 1 passed to Twig\Environment::addFilter() must be an instance of Twig\TwigFilter, string given
in Should semantic version be followed in relation to breaking changes? #2654, because passing only names as the first argument inaddFilter()
was removed as of Twig 2.0.Uncaught Error: Class "Twig_Filter_Function" not found
in Bug with latest release #2655, becauseTwig_Filter_Function
was removed as of Twig 2.0.attribute
function not working in Uncaught Error: Class "Routes" not found #2652, because attributes can’t be used to call macros anymore as of Twig 2.0, as explained by in @mrfsrf Uncaught Error: Class "Routes" not found #2652 (comment).Fatal error: Uncaught LogicException: Unable to register extension “Twig\Extension\DebugExtension” as it is already registered.
in Fatal Twig\Extension\DebugExtension Timber 1.21.0 #2661, because registering an extension twice will throw aLogicException
as of Twig 2.0.Usage Changes
None.
Considerations
I already noted in the readme.txt that the new version should be 1.22.0. Though I’m not sure whether this qualifies as a hotfix and should be tagged with 1.21.1 instead. If guess if we require WordPress 5.3 as a minimum WordPress version, that wouldn’t qualify as a hotfix anymore.
Testing
Yes.