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
- 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 -
- 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 -

Supporter timezone: Europe/Vienna (GMT+02:00)

Tagged: 

This topic contains 20 replies, has 6 voices.

Last updated by miroslavN 11 months, 1 week ago.

Assisted by: Bigul.

Author Posts
April 28, 2023 at 11:12 am #13556873

Marco

Reopening https://wpml.org/forums/topic/deprecated-rtrim-passing-null-to-parameter-1-string-php-8-1/

PHP 8.1.9
WPML Multilingual CMS 4.6.3

When activating this plugin, we see the deprecation notices immediately on /wp-admin/plugins.php and on all wp-admin. No other plugin is activated. Theme 2023.

The problem disappears when reverting PHP to 8.0.22

Find error attached.

Screenshot 2023-04-28 at 12.11.22.png
May 2, 2023 at 8:59 am #13568481

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

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

It may be a compatibility issue. Please try the following steps after a full site backup{mandatory} and let us know your feedback.

1) Deactivate the WPML Multilingual CMS plugin
2) Delete it from the plugins directory
3) Download WPML from our site here: https://wpml.org/account/downloads/ (click the button below so that you can manually download the zip file)
4) Go to Plugins>>Add new>>Upload
5) Upload the zip file
6) Activate it and make sure you are able to properly install the latest WPML version

--
Thanks!

Bigul

May 2, 2023 at 12:08 pm #13570419

Marco

Hi Bigul,

How are you since WC Asia?

I've downloaded and installed a fresh version of the plugin and the problem persists when using PHP 8.1, as you can see: hidden link

May 2, 2023 at 3:57 pm #13572435

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Marco,

Thank you for the updates. I am fine here. This requires further checking. So a couple of requests.

1) Please fill the private details fields after a full site backup{mandatory}. I would like to access the admin area of your site for further checking. Refer to the following links for more details about our private information sharing policies.

https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

hidden link

2) Please allow me to make a duplicator copy of your site using the Duplicator plugin(https://wordpress.org/plugins/duplicator/) for debugging the issue on my local server.

--
Thanks!

Bigul

May 3, 2023 at 12:11 pm #13578317

Marco

This is a local development website. There's no way to give you access.

Can't you replicate the issue by just having WordPress + WPML + PHP 8.1.9?

May 3, 2023 at 3:00 pm #13579879

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Marco,

Thank you for the updates. On my local server, I am currently using PHP 8.1 and WPML is working fine for me with WordPress 6.2. So will upgrade my PHP version to 8.2 and test it further.

One help. Please make a Duplicator copy of your site and share it with us via Google Drive or Dropbox.

--
Thanks!

Bigul

May 4, 2023 at 4:08 pm #13588449

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Marco,

I had another round of testing with PHP 8.1.13 and 8.2. But unable to reproduce the issue exactly. Please check the following screencast for more details.

hidden link

Therefore please make a Duplicator copy of your site and share it with us via Google Drive or Dropbox for further testing.

--
Thanks!

Bigul

May 5, 2023 at 1:09 pm #13594671

Marco

Hi Bigul,

I did some debug and found out that this happens when, for reasons unknown to me, $php_host_domain is NULL on the filter_include_url function on class-wpml-include-url.php
That happens when the $result input to that function is false.

I need for you to set the private message again to send you the duplicator link.

May 5, 2023 at 3:45 pm #13595541

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Marco,

Thank you for the feedback. I am enabling the private option for the next reply. Please check.

--
Thanks!

Bigul

May 5, 2023 at 5:38 pm #13596217

Marco

Here it goes the duplicator archive: hidden link
You can see the notices inside wp-admin

May 8, 2023 at 5:47 am #13601777

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Marco,

Thank you for the Duplicator package. We will debug it further and get back to you soon. Please wait.

--
Thanks!

Bigul

May 9, 2023 at 10:49 am #13612691

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Marco,

I have reproduced the issue with your Duplicator package and shared the details with our second-tier team for an expert opinion. We will get back to you as early as possible. Please wait.


PHP Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in *******\wp-includes\formatting.php on line 2786

--
Thanks!

Bigul

May 12, 2023 at 12:44 pm #13637461

Marco

Just keeping the ticket alive, as I got an email saying it was going to be closed.

May 12, 2023 at 4:56 pm #13638895

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Marco,

Thank you for the updates. It is only an alert. The ticket will not be closed. Our second-tier team is currently working on this. Please wait.

--
Thanks!

Bigul

May 18, 2023 at 10:12 am #13670953

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hi Marco,

This bug is escalated to our developers and the fix for this will be included in the future version of WPML. Most probably in WPML 4.6.4. We will get back to you soon when we have an update on this release. Please wait.

But we have a workaround for this bug. Please try the following steps after a full site backup and let us know your feedback.

1) Go to the *wp-content\plugins\sitepress-multilingual-cms\classes\url-handling* folder
2) Open the *class-wpml-include-url.php* file for edit
3) Scroll down to line 16
4) Make the following changes and save the file

From

	public function filter_include_url( $result ) {
		$domains = wpml_get_setting_filter( array(), 'language_domains' );
		$domains = preg_replace( '#^(http(?:s?))://#', '', array_map( 'untrailingslashit', $domains ) );
		if ( (bool) $domains === true ) {
			$php_host_in_domain = wpml_parse_url( $result, PHP_URL_HOST );
			$domains[]          = wpml_parse_url( $this->get_unfiltered_home(), PHP_URL_HOST );
			foreach ( $domains as $dom ) {
				if ( strpos( trailingslashit( $php_host_in_domain ), trailingslashit( $dom ) ) === 0 ) {
					$http_host_parts = explode( ':', $this->requested_host );
					unset( $http_host_parts[1] );
					$http_host_without_port = implode( $http_host_parts );
					$result                 = str_replace( $php_host_in_domain, $http_host_without_port, $result );
					break;
				}
			}
		}

		return $result;
	}

To

	public function filter_include_url( $result ) {
		if ( $result ) {
			$domains = wpml_get_setting_filter( array(), 'language_domains' );
			$domains = preg_replace( '#^(http(?:s?))://#', '', array_map( 'untrailingslashit', $domains ) );
			if ( (bool) $domains === true ) {
				$php_host_in_domain = wpml_parse_url( $result, PHP_URL_HOST );
				$domains[]          = wpml_parse_url( $this->get_unfiltered_home(), PHP_URL_HOST );
				foreach ( $domains as $dom ) {
					if ($php_host_in_domain) {
						if ( strpos( trailingslashit( $php_host_in_domain ), trailingslashit( $dom ) ) === 0 ) {
							$http_host_parts = explode( ':', $this->requested_host );
							unset( $http_host_parts[1] );
							$http_host_without_port = implode( $http_host_parts );
							$result                 = str_replace( $php_host_in_domain, $http_host_without_port, $result );
							break;
						}
					}
				}
			}
		}
		return $result;
	}

--
Thanks!

Bigul