• Resolved PICHI1966

    (@josett225)


    Hi there,

    I am getting since the 2 latest updates the following error message with my site WordPress in black out mode:
    2025/01/13 16:58:00 [error] 128486#128486: *95812 FastCGI sent in stderr: “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 /www/seriousconnection_462/public/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php on line 58” while reading response header from upstream, client: 54.36.148.157, server: https://www.seriousconnection.com, request: “GET /mentions-legales?yith_wcan=1&query_type_freinage=or&filter_freinage=full-hs HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php8.1-fpm-seriousconnection.sock:”, host: “www.seriousconnection.com:57745”

    here is the WordPress error message with all the versions details :

    Si vous cherchez de l’aide pour ce problème, les informations suivantes pourraient vous être demandées :
    WordPress version 6.7.1
    Thème actif : Woodmart (version 8.0.6)
    Extension actuelle : WooCommerce PayPal Payments (version 2.9.6)
    PHP version 8.1.28 Détails de l’erreur

    Une erreur de type E_COMPILE_ERROR a été causée dans la ligne 58 du fichier /www/seriousconnection_462/public/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php. Message d’erreur : 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

    I had also another error message after fixing first one:
    2025/01/13 17:24:22 [error] 128486#128486: *96262 FastCGI sent in stderr: “PHP message: PHP Fatal error: Declaration of WooCommerce\WooCommerce\Logging\Logger\NullLogger::log($level, $message, array $context = []) must be compatible with Psr\Log\LoggerTrait::log($level, Stringable|string $message, array $context = []): void in /www/seriousconnection_462/public/wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/NullLogger.php on line 31” while reading response header from upstream, client: 138.199.22.179, server: https://www.seriousconnection.com, request: “GET /p/manette-de-frein-trialtech-carthy-signature-droit/?add-to-cart=28660 HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php8.1-fpm-seriousconnection.sock:”, host: “www.seriousconnection.com:57745”

    Could you please help? Let me know of there is a github to fix this issue.

    I used the following code to fix it in /wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/WooCommerceLogger.php

    /**

    * Logs a message.

    *

    * @param mixed $level The logging level.

    * @param stringable|string $message The message.

    * @param array $context The context.

    */

    public function log( $level, $message, array $context = array() ): void {

    if ( ! isset( $context['source'] ) ) {

    $context['source'] = $this->source;

    }

    $this->wc_logger->log( $level, $message, $context );

    }

    And the following code in /wp-content/plugins/woocommerce-paypal-payments/modules/woocommerce-logging/src/Logger/NullLogger.php

    /**
    * Class NullLogger
    */
    class NullLogger implements LoggerInterface {


    use LoggerTrait;

    /**
    * Logs a message. Since its a NullLogger, it does not log at all.
    *
    * @param mixed $level The logging level.
    * @param \Stringable|string $message The message.
    * @param array $context The context.
    */
    public function log( $level, $message, array $context = array() ): void {
    }
    }

    Let me know if you need more information
    Jose

Viewing 1 replies (of 1 total)
  • Plugin Support Femi

    (@femiyb)

    Hello @josett225

    This error stems from a long-standing dependency version conflict and is not directly caused by PayPal Payments. Our plugin relies on psr/log version ^1.1, which is widely compatible. However, another plugin or your theme—likely using Symfony dependencies—introduced psr/log version 3.x, which is incompatible due to changes in argument types.
    Important Details:

    • This is a dependency conflict, not a PayPal Payments bug.
    • Compatibility issues like this require collaboration. While our plugin uses?psr/log?1.x, the other plugin or theme could downgrade or better yet, scope their dependencies to avoid such conflicts.
    • Upgrading to?psr/log?3.x isn’t currently feasible, as PayPal Payments still supports PHP 7.4. Updating would break compatibility for many users still on this version, causing broader issues.

    Current Resolution:
    We are working on scoping our dependencies to prevent such conflicts in the future. This change will allow PayPal Payments to function independently of other plugins or themes. A long-term solution is expected by Q1 2025.
    Short-Term Workarounds:

    • Keeping your plugin at version?2.9.4?is a stable temporary fix.
    • Alternatively, you can contact your theme developers to ask about scoping their dependencies to avoid conflicts with PayPal Payments.

    We appreciate your patience and understanding as we work toward a permanent solution. Please feel free to reach out with any further questions or concerns.

    Regards,
    Femi.

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