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.

This topic contains 3 replies, has 2 voices.

Last updated by Bigul 2 months ago.

Assigned support staff: Bigul.

Author Posts
September 27, 2020 at 6:02 pm #7109919

thomasW-84

Hi Bigul,

I checked the debug log file and sorted out all WPML related information.
It's not a lot, so I paste it below in this post. I'll need 4-5 days to get the server log. I'll post it asap.

Regards,
Thomas

[18-Sep-2020 09:11:11 UTC] PHP Warning: base64_encode() expects parameter 1 to be string, array given in /home/.sites/20/site4164262/web/wp-content/plugins/wpml-translation-management/classes/translation-jobs/class-wpml-element-translation-package.php on line 106
[18-Sep-2020 09:15:50 UTC] PHP Warning: base64_encode() expects parameter 1 to be string, array given in /home/.sites/20/site4164262/web/wp-content/plugins/wpml-translation-management/classes/translation-jobs/class-wpml-element-translation-package.php on line 106
[18-Sep-2020 09:15:50 UTC] PHP Warning: base64_encode() expects parameter 1 to be string, array given in /home/.sites/20/site4164262/web/wp-content/plugins/wpml-translation-management/classes/translation-jobs/class-wpml-element-translation-package.php on line 106
[18-Sep-2020 09:26:19 UTC] PHP Warning: base64_encode() expects parameter 1 to be string, array given in /home/.sites/20/site4164262/web/wp-content/plugins/wpml-translation-management/classes/translation-jobs/class-wpml-element-translation-package.php on line 106

September 27, 2020 at 6:57 pm #7109959

Bigul
Supporter

Languages: English (English )

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

Hi Thomas,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

This warning is last recorded in the debug log on the 18th of this month? Please create a new page for testing and send for translation, then check the issue is reproducible or not.

We had a similar issue in the past. But it was with Elementor & WooCommerce. Please check the following ticket URL for more details.

https://wpml.org/forums/topic/elementor-cant-read-wpml-category-translation-2/

https://wpml.org/forums/topic/base64_encode-expects-parameter-1-to-be-string-array-given-in-class-wpml-element-translation-package-php-on-line-106/

--
Thanks!

Bigul

September 29, 2020 at 6:39 am #7120523

thomasW-84

Hi Bigul,

I created a new debug log:
https://pastebin.com/GLhr7sR4

It includes the operation of making a new page and translating it via WPML. Page has not been published.

Thomas

September 29, 2020 at 1:08 pm #7125149

Bigul
Supporter

Languages: English (English )

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

Hi Thomas,

Thank you for the updates. We had two tickets with a similar issue last week. It shows the expected result now after the following steps. So please try it after a full site backup and make sure the issue is existing or not.

1) Open *wpml-translation-management/classes/translation-jobs/class-wpml-element-translation-package.php* for edit
2) Scroll down to the line 102
3) Make the following changes in the code & save the changes

From

		foreach ( $post_contents as $key => $entry ) {
			// phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
			$package['contents'][ $key ] = array(
				'translate' => 1,
				'data'      => base64_encode( $entry ),
				'format'    => 'base64',
			);
		}

To

		foreach ( $post_contents as $key => $entry ) {
			if (!is_array($entry)) {
				// phpcs:disable WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
				$package['contents'][ $key ] = array(
					'translate' => 1,
					'data'      => base64_encode( $entry ),
					'format'    => 'base64',
				);
			} else {
				foreach ( $entry as $subkey => $subentry) {
					$package['contents'][ $subkey ] = array(
						'translate' => 1,
						'data'      => base64_encode( $subentry ),
						'format'    => 'base64',
					);
				}
			}
		}

This fix will be included in the future version of WPML. Most probably in 4.5 version.

--
Thanks!

Bigul