Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are encountering the issue 'Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated' on PHP 8.0+. This problem is known to occur due to the trailingslashit() function in wp-content/plugins/sitepress-multilingual-cms/classes/url-handling/class-wpml-include-url.php:23.
Solution:
We recommend testing WPML 4.7 Beta, which addresses this issue. Here's how you can install it:
1. Ensure you are using the latest stable version of WPML on your test site.
2. Go to the Plugins page, click the "Add New" button, and select the "Commercial" tab.
3. Change the "Update channel" to "Beta" using the dropdown, then confirm by clicking the "Switch" button.
4. Install the beta version of WPML and any add-on plugins you use.
For more details, visit WPML 4.7 Beta release notes.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Should you need further assistance, please open a new support ticket.

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 1 reply, has 0 voices.

Last updated by Andrey 8 months, 1 week ago.

Assisted by: Andrey.

Author Posts
December 5, 2024 at 9:27 am #16480413

adrianM-34

Background of the issue:
I am trying to fix the issue 'Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated' which occurs on PHP 8.0+. This issue has been reported many times and is expected to be fixed in WPML version 4.7. I noticed that the issue is caused by trailingslashit() in wp-content/plugins/sitepress-multilingual-cms/classes/url-handling/class-wpml-include-url.php:23. The function is called with two arguments "$php_host_in_domain" and "$dom" without checking if they are null. I suggest wrapping the call in a null check: if($php_host_in_domain != null && $dom != null){}. This could be a quick fix included in a minor version. More details can be found here: https://wpml.org/forums/topic/deprecated-rtrim-passing-null-to-parameter-1-string-of-type-string-is-deprecated/

Symptoms:
I expected to see no deprecated warnings for rtrim(), but instead, I got the error: 'Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated'.

Questions:
Can this fix be implemented in the next minor version?

December 5, 2024 at 10:45 am #16480944

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

I'm sorry to hear that you've encountered this problem. We plan to release it soon.

If you have a staging site, WPML 4.7 Beta is now available for testing!

https://wpml.org/changelog/2024/11/wpml-4-7-beta-test-all-new-workflow-and-help-shape-wpml/

Installing WPML 4.7 Beta on your site is straightforward:

1. Go to your test site using the latest stable version of WPML.
2. Navigate to the Plugins page, click the "Add New" button, and then select the "Commercial" tab.
3. Use the "Update channel" dropdown to select "Beta," then click the "Switch" button in the dialog that appears.
4. Install the beta version of WPML and all the add-on plugins you use on this site.