• Resolved quadlayers

    (@quadlayers)


    Hello team

    I have founded this issue with PHP 8.2:

    'PHP message: 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/1253731.cloudwaysapps.com/edfhhdptyn/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58'

    Type Declaration Issue in WooCommerce Logger Class: This error is due to a type mismatch in method declarations between the WooCommerceLogger class and the Psr\Log\LoggerInterface it attempts to implement.

    • Error Message: 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
    • Solution: Modify the log() method in the WooCommerceLogger class so that it is compatible with the new definition in the LoggerInterface. This will likely involve allowing the $message parameter to accept both string and Stringable types, and explicitly declaring the return type as void.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Krystian from Syde

    (@inpsydekrystian)

    Hello @quadlayers

    Currently, the PayPal Payments plugin is fully supported and tested with PHP versions ranging from 7.2 to 8.1. PHP 8.2 is not yet officially supported.

    The fatal error is triggered because our plugin uses a previous version of?psr/log?, as defined in?woocommerce-paypal-payments/blob/trunk/composer.json?with?"psr/log": "^1.1"?. The more recent version that would be compatible with PHP 8.2 is this one:?https://packagist.org/packages/psr/log#3.0.0. The Psr/log version 3.0.0 requires PHP version 8.0.0 or higher and uses Union types in its arguments, which PayPal Payments doesn’t support yet. We’ll do that after migration to modularity, but this will happen in the last Q of 2024.

    Please feel free to reach out if you have any further questions.

    Kind Regards,
    Krystian

    Thread Starter quadlayers

    (@quadlayers)

    Hello @inpsydekrystian

    Thanks for your prompt reply.

    I’ve switched server version from php 8.2 to 8.1 but the issue persists.

    Please check the current php server version here: https://snipboard.io/lXIcyS.jpg

    An the logs here:

    [Mon Apr 22 10:18:00.460050 2024] [proxy_fcgi:error] [pid 252102:tid 139970903734016] [client 136.144.187.131:0] AH01071: Got error 'PHP message: 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/1253731.cloudwaysapps.com/edfhhdptyn/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58'
    [Mon Apr 22 10:18:02.911338 2024] [proxy_fcgi:error] [pid 252102:tid 139970886948608] [client 149.210.166.197:0] AH01071: Got error 'PHP message: 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/1253731.cloudwaysapps.com/edfhhdptyn/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58'
    [Mon Apr 22 10:30:56.270500 2024] [proxy_fcgi:error] [pid 288813:tid 139971012839168] [client 46.27.161.249:0] AH01071: Got error 'PHP message: 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/1253731.cloudwaysapps.com/edfhhdptyn/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58'
    [Mon Apr 22 10:30:59.098864 2024] [proxy_fcgi:error] [pid 288813:tid 139970996053760] [client 46.27.161.249:0] AH01071: Got error 'PHP message: 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/1253731.cloudwaysapps.com/edfhhdptyn/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58'
    [Mon Apr 22 10:30:59.599163 2024] [proxy_fcgi:error] [pid 288814:tid 139971141854976] [client 46.27.161.249:0] AH01071: Got error 'PHP message: 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/1253731.cloudwaysapps.com/edfhhdptyn/public_html/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58', referer: https://wordpressmu-1253731-4499451.cloudwaysapps.com/

    Plugin Support Krystian from Syde

    (@inpsydekrystian)

    Hello?@quadlayers

    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 you know which other plugin implements this version of the dependency, you could potentially ask the other plugin developer to consider downgrading the dependency version.?


    Alternatively, a potential workaround would be downgrading to PHP 7.4

    For a complete fix, we are in the process of merging a crucial update that will address this compatibility issue permanently. You can follow the progress of this update through our GitHub repository:

    We anticipate integrating these changes by Q3 with the release of PayPal Payments version 3.0+. This update will ensure that all dependency conflicts are resolved.

    Should you need any more help, feel free to reach out.

    Kind Regards,

    Krystian

    Thread Starter quadlayers

    (@quadlayers)

    Hello @inpsydekrystian

    Looks like the conflicting plugin is wp-smartpay-woo

    We’ve contacted their support

    Thanks for the update

    Plugin Support Krystian from Syde

    (@inpsydekrystian)

    Hello @quadlayers

    Thank you for your investigation and hopefully they will address it.

    Therefore I mark this as resolved.

    Kind regards,
    Krystian

    I got a similar error.As I saw PSR I thought, it’s something related to PSR module. I have enabled PHP PSR module via my cPanel to see if I have any luck and that worked.

    This was my error.

    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 /...../wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Fatal error: \Logging\Logger\WooCommerceLogger’ is closed to new replies.