Skip Navigation

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

Problem:
The client found that the WPML plugin version 4.6.8 uses the

str_contains()

function, which is only available in PHP 8, and is concerned about compatibility with older PHP versions.
Solution:
1. We confirmed that WPML no longer supports PHP 5.6. For more information, please see the minimum requirements at WPML Minimum Requirements.
2. We also referred to the WordPress minimum requirements, which can be found at WordPress Requirements.
3. We have an open ticket to double-check compatibility and have tested WPML 4.6.8 with PHP 7.4.1 without issues. We recommend trying it out and reporting any discrepancies.
4. We confirmed that WordPress defines the

str_contains()

function in its core for compatibility with older PHP versions, as seen here: WordPress compat.php.
5. If using WordPress versions older than 5.9 with PHP versions older than 8, the client may need to define the function manually to avoid errors.

If this solution doesn't look relevant, please open a new support ticket in the WPML support forum.

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 6 replies, has 2 voices.

Last updated by Andrey 1 year, 7 months ago.

Assisted by: Andrey.

Author Posts
November 30, 2023 at 5:52 pm #14965933

nicolaP-6

WPML plugin should run on php 5.6, but I saw that it contains a php8-only function.

The function is str_contains() and appears in file /sitepress-multilingual-cms/classes/request-handling/wpml-request.class.php on line 123, in plugin version 4.6.8.

hidden link

Do you plan to keep compatibility with older php versions?

Thanks

December 1, 2023 at 12:01 am #14968075

Andrey
WPML Supporter since 06/2013

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

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

Thank you for contacting WPML support.

Unfortunately, WPML no longer supports PHP 5.6. You can find more information about this change at https://wpml.org/home/minimum-requirements/.

Please note that our minimum requirements are basically in line with those of WordPress, which you can find at hidden link.

December 1, 2023 at 8:33 am #14970021

nicolaP-6

Hello Andrey, thank you for the clarification, it seems that I didn't check correctly the requirements page.

Anyway, if I'm not wrong, str_contains function requires php8, so it may cause issues with php 7 as well.

December 1, 2023 at 9:58 am #14970957

Andrey
WPML Supporter since 06/2013

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

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

Thanks for getting back to me. I appreciate the update. I also wanted to let you know that we already have a ticket in our system to double-check this compatibility.

However, I took it upon myself to test WPML 4.6.8 with PHP 7.4.1, and I didn't come across any issues. I encourage you to give it a try as well, and let me know if you notice anything different.

December 1, 2023 at 2:08 pm #14973525

Andrey
WPML Supporter since 06/2013

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

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

I received confirmation from our team that WP defines the function here: hidden link. Therefore, this will work with both the latest version of WP and older versions of PHP.

December 1, 2023 at 2:17 pm #14973585

nicolaP-6

Thank you very much for the information.

The definition of the funciton in Worpress core surely solves the issue. Anyway, I have to add that that definition, as far as I know, has been introduced in WordPress 5.9, while WPML requirements support WordPress up to 4.7.

Sorry for my fussiness, but I need to understand if WPML is compatile with older envorinments. If it's not, I just need to know it.

Thanks again.

December 1, 2023 at 2:46 pm #14973899

Andrey
WPML Supporter since 06/2013

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

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

It is true that the definition mentioned above was only introduced in WordPress version 5.9. If you are using an older version of WordPress (<5.9) along with an outdated version of PHP(<8), you may face an error while attempting to use it. In such a scenario, you will have to make definition manually.

However, despite the issue being reported to our development team, the internal ticket remains open and will only be addressed in the future.