Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Madrid (GMT+01:00)

Tagged: 

This topic contains 7 replies, has 1 voice.

Last updated by Marcel 3 days, 4 hours ago.

Assisted by: Marcel.

Author Posts
February 10, 2025 at 2:42 pm #16687946

michelleS-12

<b>Background of the issue: </b>
I am trying to use WP CLI to run the command:

wp rocket clean --confirm && wp rocket preload

This was in version 4.7.0, resolved by downgrading back to 4.6.15.

Seems to only be an issue with WP CLI, as admin interface is fine.

wp info

also has the same issue.

<b>Symptoms: </b>
I encountered a fatal error:

Fatal error: Declaration of WPML\PHP\Logger\DebugFileLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\AbstractLogger::log($level, Stringable|string $message, array $context = []): void in /srv/www/{snip}/releases/20250210140815/web/app/plugins/wpml-multilingual-cms/vendor/wpml/wpml/lib/Php/Logger/DebugFileLogger.php on line 8. Error: There has been a critical error on this website.
February 10, 2025 at 4:22 pm #16688794

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

Thanks for the details! I tested this locally using $ wp --info before and after activating WPML, but I couldn't reproduce the same error.

Could you please enable WP_DEBUG and check if any additional details appear in the debug log? Also, I noticed that your WP_MEMORY_LIMIT is currently set to 64MB, which is below our recommended minimum. While your server has 512MB available, the memory limit hasn’t been defined in wp-config.php yet. Please try increasing it and see if that resolves the issue.

Let me know how it goes!

Best regards,
Marcel

February 10, 2025 at 5:09 pm #16689055

michelleS-12

Thank you Marcel, this is from my local testing, but I have increased WP_MEMORY_LIMIT to see if it makes a difference, and no.

Regarding the debug logs, the only entry contains pretty much what I posted earlier:

[10-Feb-2025 16:46:24 UTC] PHP Fatal error:  Declaration of WPML\PHP\Logger\DebugFileLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\AbstractLogger::log($level, Stringable|string $message, array $context = []): void in /Users/{snip}/Sites/{snip}/site/web/app/plugins/wpml-multilingual-cms/vendor/wpml/wpml/lib/Php/Logger/DebugFileLogger.php on line 8

I notice that the file in question

plugins/wpml-multilingual-cms/vendor/wpml/wpml/lib/Php/Logger/DebugFileLogger.php

was added in the 4.7 release today.

February 11, 2025 at 8:47 am #16690328

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Thanks!

Are you using Bedrock with Roots Sage, right?

February 11, 2025 at 10:57 am #16690982

michelleS-12

Yes that is correct.

February 11, 2025 at 12:10 pm #16691383

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

we were able to reproduce the issue with your installed "Rollbar" plugin, that loads another newer psr/log library than ours:

Workarounds:
1) Disable Rollbar
2) Adjust our code with this temporary solution:
Open wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/lib/Php/Logger/DebugFileLogger.php and change it to this:

<?php

namespace WPML\PHP\Logger;

use Psr\Log\AbstractLogger;
use Stringable;

class DebugFileLogger extends AbstractLogger {

  public function log($level, Stringable|string $message, array $context = []): void {
    if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) {
      return;
    }

    $log = date( 'Y-m-d H:i:s' ) . ' [' . $level . '] ' . (string) $message . PHP_EOL;
    \error_log( $log );
  }

}

Does this work for you?

Best Regards,
Marcel

February 12, 2025 at 10:12 am #16695489

michelleS-12

Yes you're right, removing Rollbar resolves this, as does altering DebugFileLogger.php.

Will there be a future change to WPML to allow us to use Rollbar, or indeed any other plugin or dependency with newer psr/log?

For obvious reasons I'd not be keen on disabling Rollbar, or having to manually patch DebugFileLogger.php.

Many thanks

February 12, 2025 at 10:29 am #16695679

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

thanks for the info. Yes, we are discussing the option to remove psr completely from our codebase.

Best Regards,
Marcel