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

PHP 8 Compatibility Issues Causing Magic Method Warning and 500 Server Error #271

Open
shameemreza opened this issue Dec 17, 2024 · 2 comments
Assignees
Labels
priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue is a confirmed bug.

Comments

@shameemreza
Copy link

The Payfast extension for WooCommerce appears to have compatibility issues with PHP 8, leading to the following problems:

1. PHP Warning: The WC_Eftsecure::__wakeup() magic method does not meet PHP 8's requirement for public visibility.

[05-Dec-2024 12:54:57 UTC] PHP Warning:  The magic method WC_Eftsecure::__wakeup() must have public visibility in /home/cp62088097/public_html/wp-content/plugins/woo-eftsecure-gateway/woocommerce-gateway-eftsecure.php on line 66

2. 500 Server Error: The error occurs when WooCommerce redirects users to Payfast for payment processing. This breaks the checkout process and makes Payfast inaccessible.

  1. PHP Warning Observed During Testing: I encountered a separate PHP warning related to an undefined variable $currency_code on my test site running PHP 8.1:
PHP Warning: Undefined variable $currency_code in /srv/htdocs/wp-content/plugins/woocommerce-payfast-gateway/includes/class-wc-gateway-payfast.php on line 1829

To Reproduce

  1. Set the PHP version to 8.1 on the server.
  2. Install and activate the Payfast extension for WooCommerce.
  3. Attempt to process a payment via Payfast on the WooCommerce checkout page.
  4. Observe the following:
  • The 500 server error when redirected to Payfast.
  • Review server error logs for PHP warnings about __wakeup() and undefined variables.

Expected Behavior

The Payfast extension should function seamlessly on PHP 8.1 without generating PHP warnings or causing 500 server errors during payment processing.

Actual Behavior

Environment

  • WordPress Version: 6.7.1
  • WooCommerce Version: 9.5.0
  • Plugin Version: 1.6.9
  • Browser: Chrome latest.
  • Any other plugins installed: None active.

Additional Details

Initially reported here:

@shameemreza shameemreza added the type: bug The issue is a confirmed bug. label Dec 17, 2024
@vikrampm1 vikrampm1 added the priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. label Dec 17, 2024
@MiguelAxcar MiguelAxcar self-assigned this Dec 19, 2024
@MiguelAxcar
Copy link

MiguelAxcar commented Dec 19, 2024

Hi @shameemreza !

Thank you for bringing this to our attention. I've thoroughly investigated the reported PHP 8 compatibility issue and would like to share my findings.

  1. Tested the PayFast plugin on PHP 8.0, 8.1, 8.2, and 8.3 and I got the same result you got, i.e., I couldn't replicate the 500 error. Since __wakeup is used to prevent object unserialization, I tried to simulate scenarios where this might occur but saw no related problems, and no way for reproducing the issue.

  2. Reviewed the codebase for any potential magic method visibility issues, particularly focusing on the WC_Gateway_PayFast class and it's entire inheritance chain, also without success.

  3. Analyzed in detail the error message provided by the user - looks like the issue here potentially refers to a different extension - the EFTsecure gateway extension, not Payfast Gateway extension.

    [05-Dec-2024 12:54:57 UTC] PHP Warning: The magic method WC_Eftsecure::wakeup() must have public visibility in /home/cp62088097/public_html/wp-content/plugins/woo-eftsecure-gateway/woocommerce-gateway-eftsecure.php on line 66

In this case, I would suggest transferring this issue to the EFTsecure payment gateway repo.

Let me know if you need any further assistance.

@mommaroodles
Copy link

I'd like to share my experiences too.

I was having NO problem with the plugin until yesterday - today I got a 500 error.

I have PHP 8.2 and plugin version 1.6.9 and Woocommerce 9.5.1.

With a client's web site that is on Cloudflare - I tested with and without Cloudflare and at checkout, I was redirected to Payfast, but cancelled the order - whether the actual payment would have gone through is another story. Another test was done by a colleague and he was not redirected to Payfast which I thought was odd. Then a couple of hours later, I performed another test - no settings in WooCommerce had changed and I wasnt being redirected - at this stage, I'm not 100% sure if Cloudflare has anything to do with it. Client is on PHP 8.3, WooCommerce 9.5.1 and Payfast 1.6.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue is a confirmed bug.
Projects
None yet
Development

No branches or pull requests

4 participants