Skip Navigation

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.

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
[15-Mar-2024 05:40:44 UTC] PHP Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /home/customer/www/centrourku.org/public_html/wp-includes/pomo/translations.php:92
Stack trace:
#0 /home/customer/www/centrourku.org/public_html/wp-includes/pomo/translations.php(107): Translations->translate_entry(Object(Translation_Entry))
#1 /home/customer/www/centrourku.org/public_html/wp-includes/l10n.php(186): Translations->translate(Array)
#2 /home/customer/www/centrourku.org/public_html/wp-includes/l10n.php(297): translate(Array, 'woocommerce')
#3 /home/customer/www/centrourku.org/public_html/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-wc-gateways.php(156): __(Array, 'woocommerce')
#4 /home/customer/www/centrourku.org/public_html/wp-content/plugins/woocommerce-multilingual/classes/PaymentGateways/BlockHooks.php(36): WCML_WC_Gateways->get_translated_gateway_string(Array, 'micuentawebstd', 'title')
#5 /home/customer/www/centrourku.org/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(17): WCML\PaymentGateways\BlockHooks->WCML\PaymentGateways\{closure}(Array)
#6 /home/customer/www/centrourku.org/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Either.php(207): WPML\FP\{closure}(Array)
#7 /home/customer/www/centrourku.org/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Either.php(257): WPML\FP\Right->map(Object(Closure))
#8 /home/customer/www/centrourku.org/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Promise.php(24): WPML\FP\Right->chain(Object(Closure))
#9 /home/customer/www/centrourku.org/public_html/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wp/classes/Hooks.php(50): WPML\FP\Promise->resolve(Object(WPML\FP\Right))
#10 /home/customer/www/centrourku.org/public_html/wp-includes/class-wp-hook.php(326): WPML\LIB\WP\Hooks::WPML\LIB\WP\{closure}(Array)
#11 /home/customer/www/centrourku.org/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#12 /home/customer/www/centrourku.org/public_html/wp-includes/option.php(247): apply_filters('option_woocomme...', Array, 'woocommerce_mic...')
#13 /home/customer/www/centrourku.org/public_html/wp-content/plugins/woo-micuentaweb-payment/includes/class-wc-gateway-micuentaweb-blocks-support.php(46): get_option('woocommerce_mic...', NULL)
#14 /home/customer/www/centrourku.org/public_html/wp-content/plugins/woocommerce/src/Blocks/Integrations/IntegrationRegistry.php(53): WC_Gateway_Micuentaweb_Blocks_Support->initialize()
#15 /home/customer/www/centrourku.org/public_html/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\Integrations\IntegrationRegistry->initialize('')
#16 /home/customer/www/centrourku.org/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#17 /home/customer/www/centrourku.org/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#18 /home/customer/www/centrourku.org/public_html/wp-settings.php(643): do_action('init')
#19 /home/customer/www/centrourku.org/public_html/wp-config.php(82): require_once('/home/customer/...')
#20 /home/customer/www/centrourku.org/public_html/wp-load.php(50): require_once('/home/customer/...')
#21 /home/customer/www/centrourku.org/public_html/wp-blog-header.php(13): require_once('/home/customer/...')
#22 /home/customer/www/centrourku.org/public_html/index.php(17): require('/home/customer/...')
#23 {main}
thrown in /home/customer/www/centrourku.org/public_html/wp-includes/pomo/translations.php on line 92

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
Carlos Vecco

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:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

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.
Mateus

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
[14-Mar-2024 15:43:32 UTC] PHP Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /home/customer/www/centrourku.org/public_html/wp-includes/pomo/translations.php:92

Thanks you in advance for your help.

Sincerely,
Carlos

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.
Mateus

March 17, 2024 at 11:26 pm #15418933

carlos-danielV

Hello Mateus,

Of course. If that helps to solve the problem.

Best regards,
Carlos V.

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.
Mateus

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,
Carlos

dwcawdc.jpg
Screenshot 2024-03-25 at 10-50-59 WordPress › Error.png
Screenshot 2024-03-25 at 10-51-06 Site Tools.png
Screenshot 2024-03-25 at 10-51-16 Site Tools.png
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,
Mateus

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,
Carlos

edcdce.jpg
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.
Mateus

php8.png
posts_view.png
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.