Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-07:00)

This topic contains 7 replies, has 2 voices.

Last updated by Bobby 1 year, 7 months ago.

Assisted by: Bobby.

Author Posts
August 25, 2022 at 5:17 pm #11931121

emanuelK-5

I am trying to:
Switch from PHP 7.4 to PHP 8.1 on our WordPress site with WooCommerce & WPML.

Link to a page where the issue can be seen:
On our site, also discussed here: https://wordpress.org/support/topic/critical-error-with-php-8/
Until I found out that the site it functioning with PHP 8 and "WPML String Translation" deactivated. There are some technical comments from the WooCommerce team.

I expected to see:
No problems with PHP 8. 🙂

Instead, I got:
A critical error from WordPress and the following error report mail:

WordPress-Version 6.0.1
Aktives Theme: Deli (Version 2.0.15)
Aktuelles Plugin: WooCommerce (Version 6.8.1)
PHP-Version 8.1.9

Fehler-Details
==============
Ein Fehler vom Typ E_ERROR wurde in der Zeile 234 der Datei /usr/www/users/public/wp-content/plugins/woocommerce/includes/class-wc-post-types.php verursacht. Fehlermeldung: Uncaught ValueError: Missing format specifier at end of string in /usr/www/users/public/wp-content/plugins/woocommerce/includes/class-wc-post-types.php:234
Stack trace:
#0 /usr/www/users/public/wp-content/plugins/woocommerce/includes/class-wc-post-types.php(234): sprintf()
#1 /usr/www/users/public/wp-includes/class-wp-hook.php(307): WC_Post_Types::register_taxonomies()
#2 /usr/www/users/public/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#3 /usr/www/users/public/wp-includes/plugin.php(476): WP_Hook->do_action()
#4 /usr/www/users/public/wp-settings.php(598): do_action()
#5 /usr/www/users/public/wp-config.php(96): require_once('/usr/www/users/...')
#6 /usr/www/users/public/wp-load.php(50): require_once('/usr/www/users/...')
#7 /usr/www/users/public/wp-admin/admin.php(34): require_once('/usr/www/users/...')
#8 /usr/www/users/public/wp-admin/index.php(10): require_once('/usr/www/users/...')
#9 {main}
thrown

August 26, 2022 at 2:40 am #11933167

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

The error in the log looks like it's coming from WooCommerce's code

See the following thread please:
https://wordpress.org/support/topic/critical-error-with-php-8/

Also, PHP 8.0 has been working well but we do see in other forums as well that 8.0.1 has been known to have some issues and not be as stable yet.

August 26, 2022 at 2:45 pm #11938253

emanuelK-5

Hello, the thread you mentioned is the same thread I mentioned above and it was started by me before I came here because it turned out that the error is somehow in translations and not in WooCommerce.

Also I just tried using PHP 8.0 and it is the same as with 8.1, WordPress will work as long as "WPML String Translation" is inactive. Once I activate it, critical error.

WordPress-Version 6.0.1
Aktives Theme: Deli (Version 2.0.15)
Aktuelles Plugin: WooCommerce (Version 6.8.2)
PHP-Version 8.0.22

Fehler-Details
==============
Ein Fehler vom Typ E_ERROR wurde in der Zeile 234 der Datei /usr/www/users/public/wp-content/plugins/woocommerce/includes/class-wc-post-types.php verursacht. Fehlermeldung: Uncaught ValueError: Missing format specifier at end of string in /usr/www/users/public/wp-content/plugins/woocommerce/includes/class-wc-post-types.php:234
Stack trace:
#0 /usr/www/users/public/wp-content/plugins/woocommerce/includes/class-wc-post-types.php(234): sprintf()
#1 /usr/www/users/public/wp-includes/class-wp-hook.php(307): WC_Post_Types::register_taxonomies()
#2 /usr/www/users/public/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#3 /usr/www/users/public/wp-includes/plugin.php(476): WP_Hook->do_action()
#4 /usr/www/users/public/wp-settings.php(598): do_action()
#5 /usr/www/users/public/wp-config.php(96): require_once('/usr/www/users/...')
#6 /usr/www/users/public/wp-load.php(50): require_once('/usr/www/users/...')
#7 /usr/www/users/public/wp-admin/admin.php(34): require_once('/usr/www/users/...')
#8 /usr/www/users/public/wp-admin/plugins.php(10): require_once('/usr/www/users/...')
#9 {main}
  thrown
August 26, 2022 at 2:52 pm #11938339

emanuelK-5

One addition: Because "WooCommerce Multilingual & Multicurrency" is inactive when "WPML String Translation" is deactivated, I guess the bug could very well be in there. But it is also a OnTheGo/WPML plugin.
However when I deactivate only "WooCommerce Multilingual & Multicurrency" and leave "WPML String Translation" active before switching to PHP 8, the critical error will still occur.

August 26, 2022 at 9:24 pm #11939819

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

I can confirm that WPML itself is also not compatible with 8.0.1 yet, however, we should be compatible with PHP 8

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

September 2, 2022 at 11:38 pm #11979791

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for the duplicator package.

A few things:

1. I have not been able to reproduce this issue with a new install of WCML + WPML + WooCommerce + PHP 8

NOTE: Yes I am only reffering to any PHP 8.1.x version PHP 8.0.x should be fine with WPML and WordPress

2. In my local environment with a copy of your environment I can confirm the issue exists from 7.4 to 8.0.x

It is resolved when changing your theme from Deli to a standard WP theme.

I'd recommend reviewing the code you receive as it points to a specific string, also it is a WooCommerce theme, I believe their team should have been able to point out more information.

Let me know your results with this new information

At the moment I am not able to reproduce with a clean environment and cannot reproduce when the theme is switched from Deli.

September 13, 2022 at 9:48 pm #12046841

emanuelK-5

I tried to switch to PHP 8 with another active theme than Deli; Storefront, Twenty Twenty and Twenty Twenty-Two. It does always result in a Critical error and I have to switch back to 7.4, so for my site it does not seem to be related to the Deli theme.

When I get a mail from WordPress about the critical error, it always occurs in wp-content/plugins/woocommerce/includes/class-wc-post-types.php:234 (same error message as in previous post).
And, the site does work well with PHP 8 when "WPML String Translation" is deactivated.

I also tried once again with WP Debug Mode enabled. Following to a lot of "warning" and "deprecated" notices, exactly the same fatal error with identical stack trace occurs.

So for me it seems, the only option for now is to stick with PHP 7.4?

September 16, 2022 at 4:38 pm #12068997

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

I have been testing with Duplicator PRO on the local environment and cannot reproduce it only when using the theme Deli which uses a copy of your site.

Being that I cannot reproduce and we don't have any other similar known issues it would be tough for our team to debug

Have you been able to test locally? Possibly in a different environment from your current hosting env ?

The topic ‘[Closed] WPML String Translation plugin causes critical error with PHP 8’ is closed to new replies.