woocommerce / woocommerce-gateway-payfast

South African payment gateway supporting subscriptions, deposits & pre-orders
https://wordpress.org/plugins/woocommerce-payfast-gateway/
41 stars 15 forks source link

Update for PHP 8 #25

Closed dwainm closed 3 years ago

dwainm commented 4 years ago

Ensure the plugin works correctly on hosts running PHP 8

luizreis commented 3 years ago

I've tested compatibility with PHP8 using Exakat, PHPCompatibility, and did some smoke tests with the plugin running WP 5.6-beta4-49590, WC 4.7.0 and PHP 8.0.0rc1. I didn't find any incompatibilities during my testing.

Exakat

I set it up using the instructions in pca54o-oV-p2#comment-716. The compatible PHP estimated versions are 7.1, 7.2, 7.3, 7.4, 8.0.

image

These warnings look like false positives, though:

// Check order amount
if ( ! $this->amounts_equal( $data['amount_gross'], self::get_order_prop( $order, 'order_total' ) )
     && ! $this->order_contains_pre_order( $order_id )
     && ! $this->order_contains_subscription( $order_id ) ) {

PHPCompatibility sniff

No warnings or errors found.

Smoke tests

I set up a new store using WP 5.6-beta4-49590, WC 4.7.0, and PHP 8.0.0rc1 and installed PayFast, Subscriptions, and Pre-orders. Then, I ran the following tests:

Simple product Subscription product Pre-order product
Purchase
Refund
Renewal N/A N/A
Cancellation N/A N/A
Amount mismatch *

* An amount mismatch was triggered manually, to ensure the warnings raised by Exakat in includes/class-wc-gateway-payfast.php:424-425 were false positives.

No warnings or errors were listed in the server logs after the smoke tests were run.


Is there anything else that's worth testing or that I might've missed?

dwainm commented 3 years ago

Thanks for testing this plugin @luizreis. If you were able to do a checkout with PHP 8 I don't think we need to focus on anything else here.

It'll be a good idea to bump the plugin versions and compatibilities and do a release with those.

luizreis commented 3 years ago

It'll be a good idea to bump the plugin versions and compatibilities and do a release with those.

Good call. I'll try to fix some of the issues and take a look at the existing PRs to include them in the next release. I'm closing this one as the compatibility bumps can be done as part of the release.