I use Monolog in my project, v3.4.0, which use PSR/log 3.0.0. WPML seems to be using PSR/log 2.0.0 as its dependencies for WPML\Utilities\Logger, which implements the LoggerInterface.
As I use Monolog >= 3.0.0, it requires PSR/log 3.0.0, in which this interface has changed.
that incompatibility makes it throw an error : Declaration of Monolog\Logger::emergency(Stringable|string $message, array $context = []): void must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = [])
Firstly, to ensure the quickest and most accurate support, please provide your debug information so that I can get a look at some of your configurations. You can find it in WPML > Support > click on “Debug information” link. Please check this link for more info: http://wpml.org/faq/provide-debug-information-faster-support/
Regarding the issue, will it be possible for you to replicate the issue with your plugin/theme/code on a clean site so that I can escalate the issue to our team with proper details? Can you please:
- Login to the sandbox site that I created for you using the link hidden link
- Setup WPML and your plugin/code or theme that causes the issue.
- Try to replicate the issue on the site with minimal setup/plugins.
Then let me know the exact steps to see/feplicate the issue.
Impossible to reproduce using a sandbox.
The problem is from WPML composer dependencies.
You are using PSR/Log v2.0.0, which is outdated, but force us to use it too in our composer dependencies, because the vendor folder in the WPML plugin overrides the PSR/log V3.0.0 when we install it.
Do you have any plan in dropping support for php <= 8.0.0 and update this dependency to v3.0.0 ?
I have escalated the issue to our team to see if we can have a workaround for this or if there are plans to use the new version of PSR/Log .
In the meantime, can you please confirm that the Monolog integration that you are referring to is related to this: hidden link ?
Also, will it be possible for you to share site access to a test site in your server where we can see the incompatibility issue? I have enabled a private reply for you to share the credentials safely if it is possible. Also, please let me know how/where can I see the issue at my end.
Yes this is the dependency I'm talking about.
Unfortunately I can't share the website as it is sensitive and my company forbids it.
To reproduce it, you can install a fresh Bedrock installation (hidden link)
Install monolog using composer,
Install WPML,
Use Monolog in a theme or plugin, and it should raise the error :
Declaration of Monolog\Logger::emergency(Stringable|string $message, array $context = []): void must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = [])
Which is due to Psr\Log\LoggerInterface used in WPML (2.0.0) overriding Psr\Log\LoggerInterface in Monolog dependencies,