Overview of the Issue
If you are translating a site and your server is using PHP8+, saving a page causes a 500 server error.
If you check your debug information, you will find this error:
022/09/16 10:57:12 [error] 2388#2388: *56 FastCGI sent in stderr: ”PHP message: PHP Fatal error: Uncaught ValueError: mb_strpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack) in …/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php:283Stack trace:
#0 [internal function]: mb_strpos('<a href=”https:…', ‘wp-block’, 126)
#1 …/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(283): call_user_func_array('mb_strpos’, Array)
#2 [internal function]: WPML\FP\{closure}('wp-block’, '<a href=”https:…', 126)
#3 …/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(152): call_user_func_array(Object(Closure), Array)
#4 [internal function]: WPML\FP\{closure}('wp-block’, '<a href=”https:…', 126)
#5 …/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(48): call_user_func_array(Object(Closure), Array)
Workaround
This issue is fixed. Updating to the latest version solves it on your site, so you only need this workaround if you can’t update yet.
Our developers are aware of this situation and they are working on it. In the meantime, you can follow any of these alternatives:
- Disable WPML Media Translation plugin if you are not using it. Or
- Add this code in your functions.php theme file:
add_filter('wpml_media_content_for_media_usage', '__return_false');Or
- Downgrade your PHP version to PHP 7.4 if possible.
Still Seeing This Issue?
If updating doesn’t fix it, ask a support question and we’ll look into it with you.
Ask a support question