Monolog version conflict with WooCommerce Cybersource plugin due to non-prefixed vendor libraries
We’re encountering a fatal PHP error when the Rollbar for WordPress plugin is active alongside the WooCommerce Cybersource payment gateway plugin.
The Rollbar plugin bundles monolog/monolog via Composer but does not vendor-prefix or otherwise isolate its dependencies. This causes a version conflict when another plugin (such as WooCommerce Cybersource) includes a different version of Monolog.
Could you please vendor-prefix all Rollbar dependencies in the distributed plugin build to prevent these kinds of conflicts with other WordPress plugins? Tools like Mozart or PHP-Scoper could be used to achieve this.
Thank you for bringing this to our attention. Are you on the new v3 release?
@danielmorell Yes we're on the new v3 release.
We will get this resolved.
Thanks @danielmorell
We've also seen the same issue come up on as site with the cloudflare plugin installed as well.
We're seeing this error on rollbar plugin activation when cloudflare plugin is already installed and activated.
PHP Fatal error: Declaration of Monolog\Logger::emergency(Stringable|string $message, array $context = []): void must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = []) in wp-content/plugins/rollbar/vendor/monolog/monolog/src/Monolog/Logger.php on line 683
Unfortunately both plugins include monolog, but running are different versions of the library and are not vendor prefixed.
This is definitely one of the pain points with WordPress plugins. We will vendor prefix the dependencies we include in the version of the plugin we upload to the WordPress plugin directory.
Another install path that is an option in 3.0 and above is directly via Composer and Packagist https://packagist.org/packages/rollbar/rollbar-php-wordpress. Granted, this option only solves your issue if you can also mange the rest of your dependency tree with composer. And unfortunately, most plugins on the WP plugin directory don't do that.
Looking forward to a conflict free release. Any update?
We were just waiting on some updates to the underlying core PHP SDK to support PHP 8.5, and update the Rollbar JS version. We are putting out a release (v4.2.0) which will be included in the next version this plugin. Should be very soon.