Since updating to AIO 1.9.2, I can only access WordPress by entering recovery mode to disable Meta Box AIO. Something to do with an uncaught TypeError in twig. Possible conflict with another plugin I have installed (2FAS-light) that also uses twig.
Version 1.9.2 | By MetaBox.io | Visit plugin site
This plugin failed to load properly and is paused during recovery mode.
An error of type E_ERROR was caused in line 56 of the file /home/user/site.com/wp-content/plugins/meta-box-aio/vendor/meta-box/meta-box-builder/vendor/twig/twig/src/Lexer.php. Error message: Uncaught TypeError: Argument 1 passed to Twig\Lexer::__construct() must be an instance of Twig\Environment, instance of Twig_Environment given, called in /home/user/site.com/wp-content/plugins/2fas-light/vendor/twig/twig/lib/Twig/Environment.php on line 650 and defined in /home/user/site.com/wp-content/plugins/meta-box-aio/vendor/meta-box/meta-box-builder/vendor/twig/twig/src/Lexer.php:56 Stack trace: #0 /home/user/site.com/wp-content/plugins/2fas-light/vendor/twig/twig/lib/Twig/Environment.php(650): Twig\Lexer->__construct(Object(Twig_Environment)) #1 /home/user/site.com/wp-content/plugins/2fas-light/vendor/twig/twig/lib/Twig/Environment.php(750): Twig_Environment->tokenize(Object(Twig\Source)) #2 /home/user/site.com/wp-content/plugins/2fas-light/vendor/twig/twig/lib/Twig/Environment.php(447): Twig_Environment->compileSource(Object(Twig\Source)) #3 /home/user/site.com/wp-content/plugins/2fas-light/vendor/twig/twig/lib/Twig/Environment.ph
Twig is added to Meta Box Builder 3.1.0, which is available in the AIO 1.9.2. I think you might be right about the conflict with the 2FAS Light plugin. Do you see any error if you disable 2FAS Light or Meta Box Builder?
Yes, if I disable 2FAS Light, Meta Box AIO can be activated without a problem. But as soon as I activate 2FAS Light, WP goes into its fatal error mode again. So there's definitely a conflict between the two in how they both use twig.
When researching this on my own, I found a thread about when plugins use two different versions of the twig library, this creates issues with deprecated code in the older version.
Meta Box AIO (Builder) uses 1.42.2 (from June 2019). 2FAS Light is running 1.33.2 (from April 2017). So I suspect 2FAS is referencing something within twig that has been deprecated. And AIO's inclusion of twig supersedes the version 2FAS Light references, thus creating the error. Manually updating the version of twig that 2FAS Light uses does not solve the issue.
I have requested the developers of 2FAS Light update their version of twig here. But I’m not sure how long it will take, or if they'll be able to do so.
Thanks for valuable info. I intended to use the latest 2.x version of Twig, but it requires PHP 7.0 which is quite high at the moment. So I decided to use the latest 1.x version only.
Looks like both plugins are using Composer and it doesn't handle the version conflict quite well. The best solution is both plugins should use only stable API from Twig so they don't change across versions. But as you said, 2FAS might use deprecated APIs. I'll take a look at that plugin to see if I can make some hooks to let users choose Twig version or disable bundled Twig in Meta Box Builder.
Where can I download the version of MB AIO that doesn't have this "Twig" issue?
This also broke one of my sites due to, I believe, a conflict with WPML and unfortunately disabling that plugin is not an option.
As long as you don’t use template code option in the Builder, you’re safe to use Builder and AIO. The Twig library is lazy loaded, it’s loaded only when parsing the block code template. If you use render callback or render template, then it won’t load at all and there will be no conflict.
Hi guys, I've downgraded version of Twig to make it compatible with 2FAS Light plugin. The new version of Meta Box Builder will be released this week.