Skip Navigation

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

Problem:
If you're experiencing a PHP fatal error due to the use of the

str_contains()

function in WPML v4.6.7 on WordPress versions before 5.9, which only supports this function in PHP 8+ and has a compatibility hack for PHP 7+ in later versions.
Solution:
We apologize for the inconvenience this has caused. We have already reported this issue to our development team. In the meantime, we recommend updating your WordPress to version 5.9 or higher to avoid this error. If updating is not an option, please refrain from using WPML v4.6.7 and consider downgrading to an earlier version that does not use the

str_contains()

function.

If this solution doesn't look relevant to your situation, please open a new support ticket with us.

We have resolved the issue with the latest versions of WPML. To fix the problem, kindly update our plugins to their latest versions. If you are still experiencing issues with the latest stable version (4.6.9), try the beta version (4.6.10) from https://wpml.org/download/wpml-multilingual-cms/?section=changelog.

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 2 voices.

Last updated by Andrey 1 year, 4 months ago.

Assisted by: Andrey.

Author Posts
December 4, 2023 at 7:28 pm #14991019

Dennis

In WPML v4.6.7 the function str_contains() is used. This function has been only added to PHP 8+ and since WP 5.9 there is a compatibility hack for PHP 7+.

Thus the use of the function str_contains() in versions of WP before v5.9 fails with a PHP fatal error. Please update your minimum requirements (currently WP 4.7) or prevent the use of this function.

This has cost me a lot of time to find the reason for the failure and to restore an backup.

[04-Dec-2023 18:33:10 UTC] PHP Fatal error: Uncaught Error: Call to undefined function str_contains() in /usr/www/users/xxxx/wp-content/plugins/sitepress-multilingual-cms/classes/request-handling/wpml-request.class.php:123

December 4, 2023 at 9:02 pm #14991573

Andrey
WPML Supporter since 06/2013

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

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

I’m sorry that you ran into trouble with this. The issue has already been reported to our development team.

Thank you for reporting the issue to us.