Home›Support›English Support›[Resolved] Call to undefined function str_contains() in /sitepress-multilingual-cms1/
[Resolved] Call to undefined function str_contains() in /sitepress-multilingual-cms1/
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing a fatal error after enabling WPML, resulting in a white screen when trying to edit or add pages. The error is due to the
str_contains()
function, which is undefined in their PHP version 7.4, although WPML requires PHP 7.0 or above. Solution: This issue has already been fixed with the latest versions of WPML. Please update our plugins to their latest versions.If the issue is not solved on your site with the latest stable version, 4.6.9, you can try the beta version, 4.6.10.https://wpml.org/download/wpml-multilingual-cms/?section=changelog
**** Always try the beta version on a staging site, not a live site.****
If this solution doesn't look relevant to your situation, please open a new support ticket here.
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.
We have purchased wpml, and when we enable the plugin we are facing the below error and also the edit and add page getting white screen
Fatal error: Uncaught Error: Call to undefined function str_contains() in /home1/webnournetsa/public_html/old/wp-content/plugins/sitepress-multilingual-cms1/classes/request-handling/wpml-request.class.php:123
Our system automatically sends notifications about replies in the forum to the email address registered on your wpml.org account. In your case, it is m.alim@nour.net.sa. I'm sorry, but we cannot send it to other email addresses.
We've just noticed that the path in the error message is /home1/webnournetsa/public_html/old/. Maybe you should consider removing the /old/ folder and checking if this solves the problem.
**** Important! Please make a full site backup (files and DB) before you proceed with those steps****
In addition to the above, our second-tier supporter asks if you have hidden languages.
Can you please check and unhide them and see if the problem persists?
You can read about hiding language here.
how can we check this the plugin is thronging the error and it makes the website down and we are not able to login dashboard. this is we are trying on old folder its a copy of the main website which is running on root.
And the second problem is in production website which is running on root it shows the black page when we are trying to edit or add new page. this issue is relate WPML as well. this issue is more important then the first one because this is our production website.
In our forum, we deal with one issue per ticket. In this ticket, we deal with the fatal error issue. This issue is escalated to our second-tier supporters.
Fatal error: Uncaught Error: Call to undefined function str_contains() in /home1/webnournetsa/public_html/old/wp-content/plugins/sitepress-multilingual-cms1/classes/request-handling/wpml-request.class.php:123
You wrote:
how can we check this the plugin is thronging the error and it makes the website down and we are not able to login dashboard. this is we are trying on old folder its a copy of the main website which is running on root.
I'm sorry, but I don't understand what you are saying or asking. In my previous reply, I asked you:
In addition to the above, our second-tier supporter asks if you have hidden languages.
Can you please check and unhide them and see if the problem persists?
You can read about hiding language here.
Have you checked if the are hidden languages on your site?
You also wrote:
And the second problem is in production website which is running on root it shows the black page when we are trying to edit or add new page. this issue is relate WPML as well. this issue is more important then the first one because this is our production website.
As mentioned, we deal with one issue per ticket. Please open a new ticket for this second issue.
I ran into the same issue with str_contains, checking on php.net I see that the str_contains function was added in PHP 8.0.
Unfortunately we still run v7.4 - whereas the minimum requirement for WPML ( https://wpml.org/home/minimum-requirements/ ) state php 7.0
Can this statement be replaced by a more compatible statement?
What you wrote is true. Our second-tier supporter also mentioned this.
hidden link
The debug information of your site showed that your server uses PHP version 8.1.26. So this is the reason I didn't mention it to you before. I'm sorry; it was my mistake not to say it. Suppose you are using an older version of WordPress (<5.9) along with an outdated version of PHP(<8), you may face an error. You can read about a similar report in our forum here.