This thread is resolved. Here is a description of the problem and solution.
Problem:
The client was experiencing a fatal error after updating to PHP 8.1, which suggested that the plugin was trying to use "isset" with an array instead of an object.
Solution:
We identified this as a known issue and provided a workaround. We recommended adding the following code to the theme's functions.php file after making a full backup of the site:
add_filter( 'option_woocommerce_micuentawebstd_settings', function( $settings ) { $locale = get_locale(); foreach ( [ 'title', 'description' ] as $key ) { if ( is_array( $settings[ $key ] ) ) { $settings[ $key ] = isset( $settings[ $key ][ $locale ] ) ? $settings[ $key ][ $locale ] : $settings[ $key ]['en_US']; } } return $settings; } );
This workaround should allow the client to use the newer version of PHP without crashing the site. We also provided a link to track the progress of the issue: https://wpml.org/errata/payzen-for-woocommerce-php-fatal-error-uncaught-typeerror-md5-argument-1-string-must-be-of-type-string-array-given/.
Please note that this solution might be irrelevant if it's outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, please open a new support ticket at our support forum.
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: Known issue, WCML
Related documentation:
This topic contains 13 replies, has 2 voices.
Last updated by Mateus Getulio 6 months, 1 week ago.
Assisted by: Mateus Getulio.
Author | Posts |
---|---|
March 15, 2024 at 11:09 am #15414054 | |
carlos-danielV |
I am trying to: update php to 8.1 version Link to a page where the issue can be seen: hidden link ERROR: [15-Mar-2024 05:40:44 UTC] PHP Warning: Array to string conversion in /home/customer/www/centrourku.org/public_html/wp-content/plugins/wpml-string-translation/classes/TranslateWpmlString.php on line 211 The error suggests that the plugin is trying to use "isset" with an array instead of an object. Thank you in advance for your help. Sincerely |
March 15, 2024 at 2:45 pm #15414986 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello, I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it. Our Debugging Procedures I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site. Privacy and Security Policy We have strict policies regarding privacy and access to your information. Please see: **IMPORTANT** - Please make a backup of site files and database before providing us access. Please, let me know if you need any additional details. Have a nice day. |
March 15, 2024 at 8:20 pm #15416029 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello there, I checked it and the issue stops happening if either String Translation or Mi Cuenta Web for WooCommerce are disabled. The error message available with the debug mode seems to be partly truncated, so it is difficult to track it with precision. Is it possible for you to provide us with the HTTP error logs for today March 13th? Thank you, please let us know. |
March 16, 2024 at 10:39 am #15416546 | |
carlos-danielV |
Hi Mateus, Thank you for your reply. I have this from 14 march. [14-Mar-2024 15:43:32 UTC] PHP Warning: Array to string conversion in /home/customer/www/centrourku.org/public_html/wp-content/plugins/wpml-string-translation1/classes/TranslateWpmlString.php on line 211 Thanks you in advance for your help. Sincerely, |
March 17, 2024 at 10:48 pm #15418930 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello there, Thank you for sharing that information. So far the solutions I tried didn't work. I'd like to ask permission to make a copy/staging version of your site where I can debug this closely without affecting the live site. I'll make sure to delete this copy as soon as we get this issue fixed. I'm afraid of debugging directly on the live site and cause issues to your visitors. Also, it is important to test a different setup as part of the troubleshooting. Thank you, please let us know. |
March 17, 2024 at 11:26 pm #15418933 | |
carlos-danielV |
Hello Mateus, Of course. If that helps to solve the problem. Best regards, |
March 18, 2024 at 1:50 pm #15421516 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello, I suspect the issue could be related to compatibility between Mi Cuenta Web for WooCommerce and WPML. To pinpoint the exact cause, we need to isolate variables by replicating the issue in a sandbox environment. Here's what is needed to be done: 1- Install Essential Components Only: In the sandbox provided in my private reply above, please install your theme and only the plugins necessary to replicate the issue. Avoid importing the entire site. I already installed the Mi Cuenta Web for WooCommerce, it is available for configuration here: hidden link 2- Set Up the Page and Configurations: Mirror your current setup that's causing the issue, we only need the site to be partially replicated up to a point where we can debug this issue. 3- Notify Us Once Done: After replicating the issue in the sandbox, inform us through this ticket so we can proceed with further analysis. The goal here is to identify if the problem is indeed a compatibility issue, reproducing it in a controlled environment. We appreciate your cooperation in this matter. Let us know once you've set up the sandbox. Best, Mateus |
March 18, 2024 at 10:29 pm #15423582 | |
carlos-danielV |
Hello, I installed the site theme. The only way to replicate the bug is to upgrade php 7.4.3 to a version higher than 8.0. Thank you in advance for your help. Carlos |
March 19, 2024 at 1:54 pm #15426731 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hey there, I checked this out but so far I couldn't find a fix for it. I asked my colleagues to have a look at this issue in order to see if there's anything I'm missing. I'll come back here as soon as one of my colleagues reply back to me (which it shouldn't take long). Thanks, |
March 19, 2024 at 3:24 pm #15427272 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello there, Upon further review, our 2nd tier support team identified that this is a known issue that's being worked on by our developers. While the payment method is different, it is the same error as described in this errata, you can refer to it to track its progress: https://wpml.org/errata/payzen-for-woocommerce-php-fatal-error-uncaught-typeerror-md5-argument-1-string-must-be-of-type-string-array-given/ While we work on a definitive solution, we have this workaround that will allow you to use the newer version of PHP without crashing the site. Please add the following code to your theme's functions.php file after making a full backup of the site: add_filter( 'option_woocommerce_micuentawebstd_settings', function( $settings ) { $locale = get_locale(); foreach ( [ 'title', 'description' ] as $key ) { if ( is_array( $settings[ $key ] ) ) { $settings[ $key ] = isset( $settings[ $key ][ $locale ] ) ? $settings[ $key ][ $locale ] : $settings[ $key ]['en_US']; } } return $settings; } ); I just tested it on my staging copy and it worked as expected. After adding it, you'll be able to upgrade the PHP version without any issues. Thank you, please let us know. |
March 25, 2024 at 9:51 am #15445506 | |
carlos-danielV |
Hello Mateus, I added the code on functions.php. The error still present. Only the version 8.0.30 is working with the code but I can't be sure if this affect perfomance. I look forward to hearing from you. Thanks, |
March 25, 2024 at 8:03 pm #15448901 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello Carlos, Thank you for confirming the workaround worked with the PHP 8.0. I checked this with our team and the WordPress itself is still no fully compatible with PHP 8.3+. It is in the Beta stage of compatibility: https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ WPML is currently not fully compatible with PHP 8.3 as the WordPress itself is working to become fully compatible. We thank you for your understanding with this. Best, |
March 25, 2024 at 9:29 pm #15449083 | |
carlos-danielV |
Hello Mateus, Thank you for your reply. As you can see in my last message WPML still giving me some problems and affects my entrys. Texts are vertical. Any idea how to fix this? Unfortunately I have other plugins that will not work with php versions lower than 8.0. and the work becomes complicated with these incompatibility errors. Sincerely, |
March 26, 2024 at 1:02 pm #15451426 | |
Mateus Getulio Supporter
Languages: English (English ) Portuguese (Brazil) (Português ) Timezone: America/Sao_Paulo (GMT-03:00) |
Hello Carlos, I tried to check this but when I access both the Posts and Pages listing screen it is looking normal to me, did you manage to fix the issue on your end? Please check the screenshots. Thank you. |