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.
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
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?
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
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.
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.
@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.
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.
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 😉