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.

Tagged: 

This topic contains 10 replies, has 3 voices.

Last updated by Lauren 1 year, 7 months ago.

Assisted by: Lauren.

Author Posts
September 6, 2023 at 12:19 am #14348043

Kader

Hi,
When I update my server (godaddy) from php 7.4 to php 8.0 or 8.1, i get a php Fatal error on the frontend (debug mode).

I am using all the latest versions for my plugins and wordpress, including the latest WPML plugin / wpml addons versions.

If i switch theme to use a wordpress default theme AND deactivate all plugins except keeping only the WPML and WPML addons active, then I still get the fatal error.

If I deactivate specifically only WPML String Translation, then this solves the fatal error with php 8. I also notice that if I am using php 7.4 and go to WPML > String Translation in the admin, i get a blank page with this error :
Warning: Illegal string offset 'WPML\ST\Batch\Translation\Records_schema_installed' in /var/www/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/core-api/core/OptionManager.php on line 45
(Note: this means with php 7.4 I am unable to use string translation, and when I activate php 8.x then i cannot access wordpress admin at all due to Fatal error).

I setup a staging site to do testing (9nl.869.myftpupload.com), currently the staging is set to php 8.0 with all my normal theme/plugin active and string translation also active, therefore you will see the error on the frontend, here is a copy of the error text:

Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/www/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/core-api/core/OptionManager.php:45 Stack trace: #0 /var/www/wp-content/plugins/wpml-string-translation/classes/batch-translation/Records.php(62): WPML\WP\OptionManager->set('ST', 'WPML\\ST\\Batch\\T...', true) #1 [internal function]: WPML\ST\Batch\Translation\Records::WPML\ST\Batch\Translation\{closure}(Object(wpdb)) #2 /var/www/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Object(Closure), Array) #3 [internal function]: WPML\FP\{closure}(Object(wpdb)) #4 /var/www/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/traits/Curryable.php(57): call_user_func_array(Object(Closure), Array) #5 /var/www/wp-content/plugins/wpml-string-translation/classes/batch-translation/Module.php(30): WPML\ST\Batch\Translation\Records::__callStatic('installSchema', Array) #6 /var/www/wp-content/plugins/wpml-string-translation/plugin.php(64): WPML\ST\Batch\Translation\Module::init() #7 /var/www/wp-includes/class-wp-hook.php(310): wpml_st_core_loaded(Object(SitePress)) #8 /var/www/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array) #9 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #10 /var/www/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php(523): do_action('wpml_loaded', Object(SitePress)) #11 /var/www/wp-includes/class-wp-hook.php(310): SitePress->init('') #12 /var/www/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array) #13 /var/www/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #14 /var/www/wp-settings.php(495): do_action('plugins_loaded') #15 /var/www/wp-config.php(103): require_once('/var/www/wp-set...') #16 /var/www/wp-load.php(50): require_once('/var/www/wp-con...') #17 /var/www/wp-blog-header.php(13): require_once('/var/www/wp-loa...') #18 /var/www/index.php(17): require('/var/www/wp-blo...') #19 {main} thrown in /var/www/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/core-api/core/OptionManager.php on line 45

September 6, 2023 at 12:04 pm #14352091

Sumit
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting the support forum.
Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

Please check if these steps fix the issue:-

#1 Make sure you have a complete database and files backup of the site.
#2 Access the database and go to wp_options table and delete the key "WPML(ST)"
#3 Deactivate WPML string translation and activate it again.

Does it fix the issue? You can also ask your hosting support to perform this DB operation.

Thanks

September 6, 2023 at 3:57 pm #14354003

Kader

Hi, I do not see specifically a "WPML(ST)" row, but I do see "WPML(ST-MO)" ... should I delete that?

Screenshot 2023-09-06 115733.png
September 6, 2023 at 4:56 pm #14354225

Kader

Ok well i didnt wait for your answer and gave it a try anyways since this is only a staging site copy it doesnt matter if things break. Here is what I did exactly:

1. I switched to php 7.4, then I deleted the WPML(ST-MO) row from the database. I went into wordpress admin and deactivated the string translation plugin, then reactivated it. Finally I changed php to version 8.1 and tried to load the site but I still get the exact same fatal error as before. Therefore it seems like deleting the WPML(ST-MO) row in the database does NOT solve the issue. I am not able to find a row that is called specifically WPML(ST) either, I am not sure if that is the same thing as WPML(ST-MO).

2. I noticed while doing a search in the database that the table row named WPML_Group_Keys contained a value that referenced WPML(ST-MO), so I also deleted that row, but still this did not solve the issue when i switched to php 8.

3. Finally, since you asked to delete some things in the database, i thought maybe I could try to use a database cleanup plugin see if that helps. I used WP-Optimize to do a full database cleanup. I selected all the database optimization options (see screenshot). This took quite some time to perform. After the cleanup was finished, I tried to deactivate string translation plugin an re-activate it again, then I switched to php 8 and unfortunately this did not solve the fatal error.

Please advise what to do next, I can provide access to the staging site if needed, note however that in order to access wordpress admin i must set php to version 7.4 otherwise the admin does not work (currently I left the staging set to php 8.0 so you can see the error on the frontend hidden link).

Screenshot 2023-09-06 125416.png
September 8, 2023 at 1:35 pm #14367017

Lauren
WPML Supporter since 10/2015

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thank you for contacting WPML support. I'll be happy to help you with this. We actually have an update available for WPML core and String Translation that may resolve this. Please go to Plugins -> Add New -> Commercial and click Check for updates. It should prompt you to update to WPML 4.6.6 and String Translation 3.2.8. If you don't get those available updates, you can go to https://wpml.org/account/downloads/ and click the link to manually download the plugins and get the latest versions there.

If the error persists with the latest versions, I'd be happy to login and check your staging site. You can provide credentials in the next reply in the secure fields and i"ll look further into it.

September 8, 2023 at 5:46 pm #14368091

Lauren
WPML Supporter since 10/2015

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I found a ticket with a similar issue and it was a corrupted option. Is it okay for me to install a plugin that will allow me access to the database? If not, you are welcome to try the steps yourself.

You will need to go to the database table wp_options and search for the key 'WPML(ST)' once you locate it select and delete it. (it will be regenerated with the correct value). Try reactivating string translation plugin and let me know the results. Thanks!

September 8, 2023 at 6:59 pm #14368207

Kader

If you look at the ticket history, you will notice that I already tried this, however I could not specifically find a 'WPML(ST)' , but i did find 'WPML(ST-MO)' and delete that but it didnt help, please see the message history in this ticket.

Nevertheless, you can install plugin and look for it yourself, you can do whatever is necessary, this is a staging site so no worries if things break.

September 8, 2023 at 9:17 pm #14368509

Lauren
WPML Supporter since 10/2015

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Okay, after lots of back and forth testing, I was able to resolve it on the staging site. Here are the steps that finally worked:

1. Deactivate and delete ALL WPML plugins.
2. Download a fresh copy of only WPML Multilingual CMS and install it via Plugins dashboard.
3. Go to Plugins -> Add New -> Commercial and check the box to install and activate String Translation.
4. After that the site crashed. I renamed the string translation plugin to access the database.
5. Searched the database for WPML(ST) and found 2 results in two different tables. I removed them both.
6. Renamed String Translations plugin back to the correct name, went back to Plugins and from the dashboard activated it. BOOM! It activated without the error.

Can you please try those steps on your live site and see if you have the same results?

September 9, 2023 at 3:08 am #14368869

Kader

that is great news thank you! Ok so i will give this a try on live site and report back, however before I do so, I just have a few questions:

1. When you say i need to delete ALL wpml plugins, do you really mean ALL the WPML related plugins/addons I use:
- WPML Multilingual CMS
- WPML SEO
- WPML String Translation
- Contact Form 7 Multilingual
- WooCommerce Multilingual & Multicurrency

2. I assume that deleting every WPML plugins then re-installing them will not cause me to lose any data in ANY of the wpml plugins? ... Any settings from any of the wpml plugins/addons, or any strings that I translated... it would really be a pain to have to figure out all the things that were configured in all those plugins and have to redo everything, or maybe most of the stuff is kept intact but some things are not, which might not be immediately noticed and be missing for a while until they are noticed. Obviously, I will do backups, but I just want to know what to expect and prepare accordingly to minimize issues.

Thank again

September 9, 2023 at 9:25 pm #14370091

Kader

Hello, since it is the weekend and you likely wouldnt be able to answer until monday, i decided to try your solution and it seems to work overall, i do not notice anything missing from wpml setup/strings, but do let me know if anything in particular should be checked / redone after deleting/reinstalling everything.

Thanks!

September 11, 2023 at 2:06 pm #14377023

Lauren
WPML Supporter since 10/2015

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Happy to hear the same steps resolved the issue on the live site. There is nothing else that needs to be checked, so as long as the issue has not returned, you can close this ticket. Have a great rest of your day!