Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing a fatal error with the message 'Declaration of MonologLogger::emergency(Stringable|string $message, array $context = []): void must be compatible with PsrLogLoggerInterface::emergency($message, array $context = [])', this is due to a compatibility issue in the code.
Solution:
We recommend updating to WPML version 4.7.1, which is expected to resolve this issue. The update should be available in approximately 1-2 weeks. If you encounter this issue before the update is released, you might find a temporary workaround on the Roots forum: Roots forum discussion.

Please note that this solution might be outdated or not applicable to your specific case. If the problem persists, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If necessary, please open a new support ticket at WPML support forum for further assistance.

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.

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Dražen 1 month, 2 weeks ago.

Assisted by: Dražen.

Author Posts
February 1, 2024 at 12:52 pm #15254972

tomB-16

Fatal error: Declaration of MonologLogger::emergency(Stringable|string $message, array $context = []): void must be compatible with PsrLogLoggerInterface::emergency($message, array $context = []) in /Users/tombroucke/Valet/pacificresidences/vendor/monolog/monolog/src/Monolog/Logger.php on line 681

February 1, 2024 at 1:12 pm #15255158

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

you have been inactive for a while so I have converted the chat to the ticket.

Can you please let me know if the issue still happens with the basic starter theme and if it would be possible to share a basic new test site and steps to reproduce this issue with us?

Let me know.

Thanks,
Drazen

February 2, 2024 at 11:23 am #15258791

tomB-16

The problem is that we have dependencies in our site root (thanks to roots/bedrock). roots/acorn requires psr/log (as a subdependency of illuminate/log >monolog/monolog).

So Psr/log v3.0.0 is installed because of our root dependency roots/acorn, but this is conflicting with WPML's psr/log dependency (I assume v2.0.0). Because that older version has no return types in LoggerInterface.php, we get this error.

That's why plugin developers should be wrapping their dependencies in their own namespace.
You can do this using hidden link

See: hidden link

February 2, 2024 at 11:49 am #15258966

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks.

I have checked and this has been already escalated to our devs and is scheduled for WPML 4.7. I have added your ticket to the dev one and will update you when there is some news or release related to this.

Kind regards,
Drazen

February 2, 2024 at 11:56 am #15258971

tomB-16

Thanks for your reply. Looking forward to this release.

January 4, 2025 at 5:19 am #16562807

julienB-23

@tomB-16 Thanks for reporting. I have the exact same issue.
Could you find a fix while we are waiting on WPML 4.7?

Cheers

January 7, 2025 at 7:36 am #16568176

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello @julienb-23,

I am afraid we do not have any workaround for now, but soon new version should be released.

Also, please if you need any more info or have any other doubts, open a new ticket/chat, as this ticket is escalated to devs status, and we might miss any new replies from 3rd user.

Regards,
Drazen

January 9, 2025 at 4:22 pm #16578871

julienB-23

@Dražen How soon is soon? Because this topic is nearly one year old and I might need to change the whole stack of my project.
Maybe your dev team could come up with a temporary fix until this upgrade happens.

February 11, 2025 at 9:04 am #16690445

tomB-16

Hi,

I can't believe I waited for a whole year for 4.7, only to find out this problem has not been fixed.

Is this issue still on the roadmap?

😢

February 11, 2025 at 9:18 am #16690546

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I am afraid, its priority was moved to the 4.8 version, but I asked our devs to check for a workaround/patch so I will update you when I have some news, it will take some time.

Sorry for the trouble and hope we will get back to you soon.

Regards,
Drazen

February 14, 2025 at 8:08 am #16705141

Aitor Méndez

Same problem here. Please, fix this ASAP. I can't develop with Roots Bedrock/Sage stack.

February 14, 2025 at 8:31 am #16705193

Aitor Méndez

Workarround from Roots forum:

hidden link

February 14, 2025 at 9:03 am #16705367

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

fix should be released in version WPML 4.7.1 in 1-2 weeks approximately.

Regards,
Drazen

February 17, 2025 at 10:45 am #16713312

giuliaM-3

Declaration of Monolog\Logger::emergency(Stringable|string $message, array $context = []): void must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = [])

Hi there, same here, we are trying to get a workaround and need a fix asap 😉

February 17, 2025 at 5:25 pm #16715859

lorenzoC-17

Same here, need fix ASAP.. Thx