opened
pahandel
username_0
Probably simply due to the fact that MailPoet's twig instance is found first. 

## What version of WordPress, PHP and Timber are you using?
Wordpress 5.1.1
Timber 1.9.2 with twigs version 1.34.4
MailPoet 3 (New) 3.21.1 with twigs version 1.38.0 (as included in the Avada theme)
MyPlugin utilizing Timber

## How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)
Installed as plugin from WP.org
twig loader loads mailpoet's twig instance and fails due to conflicting twig versions
issue
created
palmiak
username_1
https://github.com/timber/timber/issues/1950 - we also had this problem.

BTW @username_4 @pascalknecht @username_2 why do we have ` "twig/twig": "1.34.*|2.*",` and not ` "twig/twig": "1.38.*|2.*",` with https://github.com/twigphp/twig-cache-extension/pull/6#issuecomment-472064244 we could adopt the newer version.
comment
created
pahandel
username_0
Thanks for the hint!
The resulting fatal error seems to look like the same and maybe there's something wrong with MailPoet's twig (although it doesn't throw any errors when used within MailPoet)
My first thought was that Timber's and MailPoet's twig instances interacted somehow resulting in that error. Probably a wrong assumption.
Anyhow, the fact remains that Timber is loading another plugin's twig instance instead of it's own if there is one - at least if it's alphabetically 'below'.
comment
created
gchtr
username_2
And of course, we could move to `twig/cache-extension`, as discussed in #1950.
comment
created
gchtr
username_2
I just found [this pull request](https://github.com/mailpoet/mailpoet/pull/1911) which is very interesting. Mailpoet seems to have prefixed its Twig version so that there should be no more conflicts with Timber. They use [php-scoper](https://github.com/humbug/php-scoper) to move Twig to a `MailPoetVendor` namespace.

@username_0 Could you please check with MailPoet’s most recent version if the problem still exists?

This doesn’t mean that we shouldn’t update Twig. I made a pull request in #1963.
comment
created
gchtr
username_2
Let’s wait for #1977 to be merged, before we close this.
comment
closed
gchtr
username_2
issue
created
MikeNGarrett
username_3
I'd like to reopen this issue, if I can. MailPoet fixed their dependency conflicts with the php-scoper solution you highlighted, but more plugins are starting to use Composer without this feature. This continues to cause conflicts with Timber's Twig implementation. While these other plugins also need to prefix their vendor libraries, I think it would be a good idea for Timber to do the same.
comment
reopened
jarednova
username_4
Probably simply due to the fact that MailPoet's twig instance is found first. 

## What version of WordPress, PHP and Timber are you using?
Wordpress 5.1.1
Timber 1.9.2 with twigs version 1.34.4
MailPoet 3 (New) 3.21.1 with twigs version 1.38.0 (as included in the Avada theme)
MyPlugin utilizing Timber

## How did you install Timber? (for example, from GitHub, Composer/Packagist, WP.org?)
Installed as plugin from WP.org
timber's twig loader loads mailpoet's twig instance and fails due to conflicting twig versions
issue
created
gchtr
username_2
@username_3 Yeah, I guess you’re right. But I think we wouldn’t ship an already namespaced Timber. Timber is not a self-contained package like most plugins, but a set of dependencies. If there are two dependencies that require Timber, then we would be at the same place as before.

Instead we could provide a guide for how to namespace Timber and its dependencies or just parts of it (e.g. Twig only) using [coenjacobs/mozart](https://github.com/coenjacobs/mozart). I recently tried it out and it almost worked. There are some small updates we need to make to Timber to make it compatible. But I think that’s the approach we should take.
comment