Support » Plugin: WooCommerce PayPal Payments » Fatal Error when activating plugin

  • Resolved teddyh

    (@teddyh)


    When I attempt to activate this plugin on my site, I get the following error:
    Fatal error: Declaration of WooCommerce\WooCommerce\Logging\Logger\WooCommerceLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\LoggerTrait::log($level, Stringable|string $message, array $context = []): void in /var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58
    Has anyone experienced this and know a way to fix?
    Thank you very much in advance,
    Teddy

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Andreas W.

    (@aweissinpsyde)

    Hello @teddyh

    It sounds like there might be a conflict with another plugin on your site. What I advise you to do, is to create a staging site and perform a full conflict test to rule out eventual issues with the theme or a different plugin.

    We recommend temporarily activating the default theme Storefront and disabling all other plugins except for WooCommerce and PayPal Payments to see if the behavior persists.

    You may also try an older version and see if that works for you. Previous versions of the PayPal Payments plugin can be downloaded from the bottom of this page: https://wordpress.org/plugins/woocommerce-paypal-payments/advanced/ or here if you are encountering any problems specifically with the latest version.

    Kind regards
    Andreas

    Hello, we’ve detected exactly the same error when updating a third party plugin: WooCommerce Prices By User Role. With the previous version everything works without any problem.

    PHP Fatal error: Declaration of WooCommerce\WooCommerce\Logging\Logger\WooCommerceLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\LoggerTrait::log($level, Stringable|string $message, array $context = []): void in /home/XXX/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58

    Their technical support tells us this: “When we activated our plugin, the paypal payments plugin was recording the site logs and using the deprecated Woocommerce method and this is causing an error.”

    Any idea?

    Best regards.

    Art Project Group

    (@artprojectgroup)

    Tested with your latest version and I get the same error.

    Any idea?

    Best regards.

    Plugin Support Inpsyde Niklas

    (@niklasinpsyde)

    Hi @teddyh & @artprojectgroup,

    This error is a compatibility problem caused by a dependency in a different plugin and is not so easy to resolve from our perspective.
    Most likely, some other plugin on your site implements the library psr/log in version 3.0.0 which is not compatible with the version used in PayPal Payments.

    The first step would be to isolate the cause of the conflict, so you may want to perform a full conflict test to understand which other plugin may be involved. We recommend temporarily activating the default theme Storefront and disabling all other plugins except for WooCommerce and PayPal Payments, and then enabling other plugins one by one to see when the error occurs.

    Once we know which other plugin implements this version of the dependency, we could potentially ask the other plugin developer to consider downgrading the dependency version. The offending version requires PHP 8 and does not add anything important, but PayPal Payments supports PHP 7.2, so it is not possible for us to update for now.
    There may be other ways to resolve the issue, but we would need to know more about how widespread this compatibility issue is. Apart from the two reports in this thread, I’m seeing only one more request about it, so it is still a fairly low priority issue.

    Please let us know if you figure out what other plugin would be involved in this conflict. Thanks!

    Kind regards,
    Niklas

    Art Project Group

    (@artprojectgroup)

    Hi @niklasinpsyde.

    In my case it is a multisite installation with PHP 8.0.25, WordPress 6.1.1 and WooCommerce 7.1.0. The plugin that generates the fatal error is the already indicated: WooCommerce Prices By User Role. After activating it this error is generated:

    [21-Nov-2022 18:37:49 UTC] PHP Fatal error: Declaration of WooCommerce\WooCommerce\Logging\Logger\WooCommerceLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\LoggerTrait::log($level, Stringable|string $message, array $context = []): void in /home/XXX/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58

    Tell me what I tell the author.

    Best regards.

    Art Project Group

    (@artprojectgroup)

    And yes, that plugin has /vendor/psr/log.

    Thank you for your great support.

    Best regards.

    Plugin Support Inpsyde Niklas

    (@niklasinpsyde)

    Hi @artprojectgroup,

    Have you tried it with a previous PHP version, such as PHP 7.4?
    It may help us with testing if you could send us a copy of the plugin, as I’m not sure which one it is and if it’s a paid one or not.
    You could privately reach out from here: https://paypal.inpsyde.com/docs/request-support/
    Please include a link to this thread when sending a private message.
    @teddyh Are you using this Prices By User Role plugin as well, or could you find out which other plugin causes the conflict for you?

    Unfortunately, our options are severely limited to deal with this compatibility problem for the time being.
    So the best first step would be asking the other plugin developer if they could consider downgrading the psr/log library to an older version. As far as I understood it from our developers, this latest version provides minor benefits, but it’s not possible for us to use it.

    Kind regards,
    Niklas

    Art Project Group

    (@artprojectgroup)

    Thank you. They have solved it in the new version.

    Best regards.

    Plugin Support Inpsyde Niklas

    (@niklasinpsyde)

    Thanks for the feedback. Glad to hear the problem could be solved this way.
    Since we haven’t head back from @teddyh, I’ll mark this resolved for now.

    Kind regards,
    Niklas

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.