Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal Error on 2.9.5 #2894

Open
ainsleyclark opened this issue Dec 10, 2024 · 6 comments
Open

Fatal Error on 2.9.5 #2894

ainsleyclark opened this issue Dec 10, 2024 · 6 comments

Comments

@ainsleyclark
Copy link

ainsleyclark commented Dec 10, 2024

Describe the Bug

After updating to v2.9.5 I receive the following error which has bricked a production site:

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

@robertkinsella
Copy link

Experienced the same issue here today also - I have had to revert back to v2.9.4 for the site to function again.

@goodjobjohn
Copy link

goodjobjohn commented Dec 10, 2024

Experienced the same issue here today also - I have had to revert back to v2.9.4 for the site to function again.

+1

@SydeKrystian
Copy link
Collaborator

Hello @ainsleyclark

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.

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.

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

Kind Regards,
Krystian

@jjmoody
Copy link

jjmoody commented Dec 13, 2024

I have the same issue; no one will be downgrading for PayPal. I suggest PayPal upgrade or see customers move on to other payment options—just a thought.

@ainsleyclark
Copy link
Author

Hi @SydeKrystian,

Thanks for your reply.

I understand the plugin currently relies on psr/log "^1.1". Upgrading to a version compatible with PHP 8.2 (such as 2.x or 3.x) should maintain backwards compatibility unless there are specific constraints within the plugin.

Running a full conflict test is resource-intensive, and the issue seems related to dependency management rather than a conflict with other plugins.

Thank you.

@lvvvvvl
Copy link

lvvvvvl commented Dec 15, 2024

I'm not sure if it's related to the same error, but after updating to hosting to PHP 8.2 and updating Woocommerce Paypal Payments to 2.9.5 on the same day, my kinsta hosting error log is flooding with these errors and I haven't had any sales since I did the updates 3 days ago (which is rare) even though my front and backend of the site don't display any errors or issues for me:

2024/12/14 00:51:16 [error] 6850#6850: *698283 FastCGI sent in stderr: “PHP message: PHP Fatal error: Uncaught Error: Call to undefined function WooCommerce\PayPalCommerce\Blocks\wc_terms_and_conditions_page_id() in /www/shop_225/public/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-blocks/extensions.php:47

Stack trace:

#0 /www/shop_225/public/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Inpsyde/Modularity/Container/ReadOnlyContainer.php(133): WooCommerce\PayPalCommerce\Blocks\BlocksModule->WooCommerce\PayPalCommerce\Blocks\{closure}(Array, Object(WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer))

#1 /www/shop_225/public/wp-content/plugins/woocommerce-paypal-payments/lib/packages/Inpsyde/Modularity/Container/ReadOnlyContainer.php(72): WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Container\ReadOnlyContainer->resolveExtensions(‘wcgateway.setti…’, Array)

#2 /www/shop_225/public/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-wc-gateway/services.php(549):” while reading response header from upstream, client: 188.74.137.134, server: shop.mysite.com, request: “GET /terms-and-conditions/?customize_changeset_uuid=e4d7dafb-388f-484b-8355-cd903276b3ac&customize_messenger_channel=preview-0 HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php8.2-fpm-shop.sock:”, host: `“shop.mysite.com:64493”

How do I isolate what plugin could be conflicting if the front end works fine, and the error log doesn’t follow any pattern of how frequently the error is occuring?`

Is this related to the same issue and if so should I downgrade to 2.9.4 oe reverse the PHP 8.2 to 8.1 again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants