Wp-rocket: [WIP] Possible conflict with Woocommerce 4.4.0

Created on 18 Aug 2020  路  35Comments  路  Source: wp-media/wp-rocket

We're receiving tickets from customers having a fatal error after updating Woocommerce to 4.4.0.
Still investigating this. According to Remy, it looks like they are using the same container package as us, but not the same version, they are on the new one that requires PHP 7 and that includes breaking changes.

Errors are similar to this:
Fatal error: Declaration of League\Container\ImmutableContainerAwareTrait::getContainer() must be compatible with League\Container\Argument\ArgumentResolverTrait::getContainer(): Psr\Container\ContainerInterface in /home/446954.cloudwaysapps.com/krxgzndejz/public_html/wp-content/plugins/wp-rocket/vendor/league/container/src/Inflector/Inflector.php on line 32

3rd party compatibility 馃敟critical

Most helpful comment

I did this, I download the plugin and I uploaded to my webserver. That worked for me.

All 35 comments

WooCommerce 4.4 started to use the same container package as us: https://github.com/woocommerce/woocommerce/blob/b3097dbae6533efd569be95c20076a68bc146714/composer.json#L14

But they are using version 3, which is only compatible with PHP 7, while we still use version 2 (for now).

Composer being what it is, only one version of the package is loaded, during the runtime, and Since version 2 & 3 of the container are not compatible, it's preventing our code from running as expected.

Same problem with 7 clients. Any workaround except stopping the plugin?

Yep got it also on all my sites, just disable until the new release

There is a PR about it. Hopefully, it can be merged soon.

Same. 20+ client sites affected. Not cool.

PR is now in QA. Making sure we don't break anything else or have any regressions. Once we can confirm it's all good, we'll be releasing.

Hello @MrGKanev @101sam @joshlcomstock,

WooCommerce released 4.4 earlier today which included changing the container (League Container) to a PHP 7 only version. Rocket also uses the League Container; however, we use a PHP 5.6 compatible version.

The fatal error occurs when either plugin loads the container first. How? Each expects a particular version, but only one version gets loaded into memory by Composer.

The 3.6.4 fix that's in QA right now will be released today...very shortly.

What did we change?

  1. The Container version we need is now packaged inside of Rocket's Engine (not loaded via Composer).
  2. Th namespaces for it are renamed.

How does this fix the problem?

  1. WooCommerce uses the League\Container classes, traits, etc.
  2. Rocket now uses the WP_Rocket\Engine\Container - which is a copy of the League Container files ... renamed.

To PHP, these files of classes, traits, etc. are now different. No more fatal errors from this problem.

@iCaspar @hellofromtonya

Well, i cant downgrade wordpress/woocommerce anymore. Wp rocket now disabled during this fatal error but can i still update and re-activate it? Because it's not activated right now and if i remember well wp rocket can only be updated when it's enabled..

[email protected] is also not receiving any mails, Mail Delivery System - user over quota...

I have just gone through and deactivated the WooCommerce 4.4.0 plugin and WP-Rocket is able to be reactivated without issue. Hopefully, WC releases their fix soon.

[email protected] is also not receiving any mails, Mail Delivery System - user over quota...

Sorry about that @ChrisSmoke1. We cleared out the email server and emails are flowing again. Can you resend to us please? I apologize in advance for the inconvenience.

Well, i cant downgrade wordpress/woocommerce anymore. Wp rocket now disabled during this fatal error but can i still update and re-activate it? Because it's not activated right now and if i remember well wp rocket can only be updated when it's enabled..

@ChrisSmoke1 Yes, Rocket needs to be activated in order to update it through the admin area. However, reactivating it now will cause a fatal error since WooCommerce is at version 4.4. on your site.

What can you do? Please reach out to our Support team for guidance on how to load the Rocket 3.6.4. Here's a reference for you too.

I did this, I download the plugin and I uploaded to my webserver. That worked for me.

@sknight80 That's wonderful!

@MrGKanev @101sam @joshlcomstock

We have released 3.6.4 with the fix for fatal error due to conflicts with WooCommerce 4.4 release. Here is a document that guides you in how to update Rocket.

Thank you for your patience.

Yep, I saw it the moment it went up. Thanks! :)

Like described in https://github.com/woocommerce/woocommerce/issues/27384 namespaced / scoped dependencies should prevent such cases in the future:

Not sure if namespaced dependencies are used but this would prevent such issues in the longterm:

https://github.com/humbug/php-scoper
https://github.com/coenjacobs/mozart
https://github.com/TypistTech/imposter-plugin

So the composer autoloader will not use the wrong class / dependency with a different interface.

Thanks @DanielRuf for sharing and looping the WC issue back here. Appreciate it. And yes, you're right. There are ways to encapsulate specific external dependencies. After this problem, we are talking that step.

I want to thank WP-Rocket to sent also the "Important Information for WooCommerce Users" e-mail to all customers. Backup was done and just wanted to hit the upgrade option for wordpress Pfff ;-)
Recommendation? Just wait for next Woo upgrade/fix?

FTP upload and re-activate WP Rocket 3.6.4 worked :-)

@PeterTemps That error is typically due to something with going wrong during the update process or missing or old composer files. I'd suggest using FTP/SSH to bring all of the Rocket 3.6.4 files over to your server. Check out the FTP section of this doc.

Recommendation? Just wait for next Woo upgrade/fix?

@Mic2005 First of all, your welcome. What do we recommend? Update to WP Rocket 3.6.4 _before_ updating WooCommerce.

@PeterTemps That error is typically due to something with going wrong during the update process or missing or old composer files. I'd suggest using FTP/SSH to bring all of the Rocket 3.6.4 files over to your server. Check out the FTP section of this doc.

I'll try. Thanks!

i had the same issue. i installed now the newest wp rocket, it did activated but the site is working 10 times slower than without it...any suggestions?

We have a similar problem, but we are working with the NGINX server. What we saw that the new version remove all our settings (in WordPress), and we need to reconfigure all the parameters (we are still trying to figure out where, if its real problem or just configuration)

@aniatanasova Hmm, I'm not sure why or what. But we'd like to dig into it further with you. Could you please open a Support ticket? We'll write you back to give you a safe way to share credentials with us.

We have a similar problem, but we are working with the NGINX server. What we saw that the new version remove all our settings (in WordPress), and we need to reconfigure all the parameters (we are still trying to figure out where, if its real problem or just configuration)

After a few rounds, we found out that the only way to go back to the same speed is to set up the parameters manually and not import/export - why I'm not sure, but its work on two different sites using NGINX.

Thank you all for the quick fix

@101sam Hmm that's interesting. The update "shouldn't" have removed settings. However, you experienced something that did just that. Hmm, I'm not sure why. But I do want to know.

If you'd like, feel free to open a Support ticket. We can dig into with you.

@aniatanasova Hmm, I'm not sure why or what. But we'd like to dig into it further with you. Could you please open a Support ticket? We'll write you back to give you a safe way to share credentials with us.

i did open a new issue and i also emailed at support.

@101sam Hmm that's interesting. The update "shouldn't" have removed settings. However, you experienced something that did just that. Hmm, I'm not sure why. But I do want to know.

If you'd like, feel free to open a Support ticket. We can dig into with you.

It's happening on two different servers, so I'm sure we can replicate it. But I need time for the client to come down. The problem we had as soon as the crash happens, we couldn't return to WordPress. WP command line not works, we had to delete the wp-rocket folder. Maybe this was not the optimal way, but that's the only way we manage to recover the site from the crash. We didn't want to login to the MySQL as WooCommerce has a database update during the update. It was risky to play with the wp_options at that stage.

@101sam what tool or tools did you use for speed measure?

We notice the speed changes from monitor we have on the site using:

https://gtmetrix.com

We verify it with:

https://developers.google.com/speed/pagespeed/insights/

To debug and verify its coming from we-rocket
We add the following lines and use Query Monitor to verify its not other plugin or WooCommerce updates.

ini_set('display_errors','On');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
define( 'WP_DEBUG_LOG', '/tmp/log/wp-errors.log' );
define( 'SCRIPT_DEBUG', true );

@101sam Have you found it to be the settings in WP Rocket? Or something else?

Can't tell, it looks like a combination of situations:
Trying to update WooCommerece + crash happens, and WooCommerece database update was on the way.

Or one of our crontab tried to kick in the middle of updates or while we upgrade.

Or it was Wordfence blocking changes of code.

you have to upgrade to 4.4.1, there is a fix for it : https://woocommerce.wordpress.com/2020/08/19/woocommerce-4-4-1-fix-release/
update with the latest version of WC and problem solved !

Was this page helpful?
0 / 5 - 0 ratings