Skip Navigation

Open

Reported for: WPML Multilingual CMS 4.6.4

Topic Tags: Bug

Overview of the issue

Updating to WPML 4.6.4 on a server with OpCache caching engine might result in an unexpected fatal error when using your backend. Specifically when using a deployment pipeline.

2023/06/22 02:36:16 [error] 359706#359706: *507646 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: WPML\User\UsersByCapsRepository::__construct(): Argument #2 ($languagePairs) must be of type WPML\User\LanguagePairs\ILanguagePairs, WPML_Language_Pair_Records given, called in .../wp-content/plugins/sitepress-multilingual-cms/classes/container/class-config.php on line 63 and defined in .../wp-content/plugins/sitepress-multilingual-cms/classes/user/UsersByCapsRepository.php:18

Workaround

Please, make sure of having a full backup of your site before proceeding.

Option 1

Restarting your PHP server should fix this issue. Please, contact your server provider and request a PHP-FPM service restart.

Option 2

1. Check if the new files are present

  • Open ../wp-content/plugins/sitepress-multilingual-cms/classes/language/class-wpml-language-pair-records.php
  • Check if the file is correctly placed. It should contain this code in line 14:
    1
    class WPML_Language_Pair_Records implements ILanguagePairs {

    Insead of:

    1
    class WPML_Language_Pair_Records {
  • If that’s not the case, it would indicate a problem in the deployment process and you need to check it.

2. If you see that the file content is correct

You can alternatively invalidate your OPCache for that specific file.

  • Run this from a http-served script (not CLI/SSH):
    1
    opcache_invalidate( '/wp-content/plugins/sitepress-multilingual-cms/classes/language/class-wpml-language-pair-records.php', true);

3. Finally, verify that you don’t have a /Language/ remaining folder

  • Open your /wp-content/plugins/sitepress-multilingual-cms/classes/ folder.
  • Look for a remaining /Language/ folder with uppercase.
  • If that’s the case, please remove the /Language/ directory and made sure that the /language/ one had the files from the WPML 4.6.6 release.

If the issue persists, please contact WPML support. It would be really helpful if you send us the content of your phpinfo().

5 Responses to “Opcache - PHP Fatal error: Uncaught TypeError: WPML\User\UsersByCapsRepository::__construct(): Argument #2 ($languagePairs) must be of type WPML\User\LanguagePairs\ILanguagePairs…”

    • Hello there,
      Our devs are aware of this situation. We will update this erratum when we have any news.
      Regards

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>