WPML
Status
Resolved
Reported for
WPML Multilingual CMS 4.5.10
Resolved in
4.5.12
Topic tags
Bug, Compatibility

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:283

Stack 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

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.

All known issues →