Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 9 replies, has 3 voices.

Last updated by thomas mang 7 months, 3 weeks ago.

Assigned support staff: Riffaz.

Author Posts
April 18, 2019 at 7:44 am #3636883

Pieter

There is a conflict with the Shield plugin due to how Twig is loaded in WPML.

From the thread on WP Support forum where Shield developer explains the issue (https://wordpress.org/support/topic/shield-conflict-with-wpml-twig/):

> Shield includes 3rd party libraries, like TWIG and use standard PHP methods to do so – namely Autoloaders.

> This allows multiple plugins to include the same library without conflicts. However, it appears that WPML isn’t using this method and is including libraries without checking that they are already loaded.

It is quite silly to think that WPML introduced Twig a while ago now, and that it has done so without adding the necessary checks.

Please fix this ASAP!

Related errors:

PHP Warning: Cannot declare class Twig_Environment, because the name is already in use in /wp-content/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Environment.php on line 1647
PHP Warning: Cannot declare interface Twig_LoaderInterface, because the name is already in use in /wp-content/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Loader/LoaderInterface.php on line 61
PHP Warning: Cannot declare interface Twig_ExistsLoaderInterface, because the name is already in use in /wp-content/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Loader/ExistsLoaderInterface.php on line 33
PHP Warning: Cannot declare interface Twig_SourceContextLoaderInterface, because the name is already in use in /wp-content/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php on line 38
PHP Warning: Cannot declare class Twig_Loader_Filesystem, because the name is already in use in /wp-content/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Loader/FilesystemLoader.php on line 303
PHP Warning: Cannot declare interface Twig_CacheInterface, because the name is already in use in /wp-content/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Cache/CacheInterface.php on line 60
PHP Warning: Cannot declare class Twig_Cache_Null, because the name is already in use in /wp-content/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Cache/NullCache.php on line 42
PHP Fatal error: Cannot redeclare twig_array_batch() (previously declared in /wp-content/plugins/sitepress-multilingual-cms/vendor/twig/twig/lib/Twig/Extension/Core.php:1557) in /wp-content/plugins/wp-simple-firewall/src/lib/vendor/twig/twig/src/Extension/CoreExtension.php on line 1650
April 18, 2019 at 7:56 am #3636949

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

Thank you for contacting WPML support.

As you see these errors are not coming from WPML.
This is coming from 'wp-simple-firewall'

Please disable the plugin "wp simple firewall" and check the issue.

Let me know how it goes.

Regards,
Riffaz.

April 18, 2019 at 8:02 am #3636993

Pieter

Please don't blame others for things that WPML doesn't do in the correct way.

The reason the errors get triggered is because WPML includes the libraries without checking that they are already loaded.

Can you please kick this ticket up to 2nd tier support?

April 18, 2019 at 9:01 am #3637491

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

Sorry for the misunderstanding.
Our second tier is checking this already.
You can follow this as well: https://wpml.org/forums/topic/twig-library-conflicts-with-shield-pro/

Please be patient till we get back to you again.

Regards,

April 18, 2019 at 10:24 am #3638255

Pieter

Any idea on how long this is going to take?

Basically any site that uses Twig (in another place than WPML) AND has included the library in the proper way is punished now, because of the way that WPML declares it (by not checking whether it already exists).

It would be very disappointing if this matter is not handled with some urgency!

April 18, 2019 at 11:12 am #3638663

Pieter

In the meantime the developer of the Shield plugin also looked into the matter and he has made the following information available:

I managed to get hold of a copy of WPML from another client and I’ve investigated their code. So it turns out WPML is not including their code badly, even though the error suggests this. So that’s my bad, so firstly I apologise for saying such when it turns out they weren’t. The problem is a bug with TWIG in this old version:

1. This is a bug with an older version of TWIG. They’re using v1.32.0 dating back to 2017-02

2. Bug reference:
hidden link

3. This is fixed in 1.34.4+. If they update their Twig library to this version, it’ll fix the problem.

Thanks!

April 18, 2019 at 2:31 pm #3640007

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

I am passing this all to the relevant department.
Please be patient till we get back to you.

Regards,

April 21, 2019 at 8:18 am #3651865

Pieter

I received an auto reply from the "clean-up robot" that this ticket is set to be closed if I don't leave a response.

With the incredible backlog of tickets you guys have, one can only wonder why there is no condition where the client (me) is waiting for support (you) to come up with a solution in a decent amount of time (not more than 3 days) instead of using the condescending

Please be patient till we get back to you.

And then let to clean up robot close this ticket after 3 days of waiting.

This issue is NOT SOLVED and I am waiting for WPML to FIX it.

April 22, 2019 at 11:19 am #3655341

Riffaz
Supporter

Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)

Hi,

We are going to update twig soon.
We keep this version of Twig because of backward compatibility with older PHP versions.
This will probably happen in WPML 4.3.0 and we do not have a ETA yet for this.

The plugin you are using 'Shield pro' that uses twig ver 1.34 or above.
That version does not support PHP 5.2 and WPML still support that as noted above.
So for the users who sre using still older version of PHP still can use the WPML.

I'll update to you again when we have anther update regarding this.

Regards,

June 6, 2019 at 1:34 pm #3969535

thomas mang

Gotta support Pieter here - this is definately a probleme if you use eg Timber in your theme. So this makes WPML unusable for us when developing custom themes with Timber (which we do a lot).
As a workaround when using Timber/have control over how Twig is used: You can downgrade twig to v 1.38^ ( <2) in your composer.json