Skip Navigation

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.

2 Responses to “PHP 8 - When saving a page there is PHP Fatal error: Uncaught ValueError: mb_strpos()”

  1. I would like to ask if there’s any progress on fixing this issue yet?
    It is halting progress on our customer portal and the provided workarounds don’t seem to work for us. Downgrading the PHP version is not an option for our website.

    • Hello!
      I have indications from our developers that the exact issue with media translation should be resolved in WPML ver. 4.5.11

      However, if you still have the issue, I’d suggest to please open a ticket in our support forum so that our specialists can investigate the problem further.