vippsas / vipps-recurring-woocommerce

Vipps Recurring payments for WooCommerce
GNU Affero General Public License v3.0
6 stars 4 forks source link

Uncaught TypeError triggers fatal error in PHP 8.0 #62

Closed magnuskl closed 1 year ago

magnuskl commented 1 year ago

Line 1104 in wc-gateway-vipps-recurring.php tends to produce an uncaught TypeError when $agreement_id is a string. This triggers a mere warning in PHP 7.4—but a fatal error in PHP 8.0, causing the script to abort. See also: PHP ManualAppendicesMigrating from PHP 7.4.x to PHP 8.0.xBackward Incompatible Changes.

Marcuzz commented 1 year ago

Hi,

Thanks for reporting this bug. I think we are using the wrong variable here. I'll look into it.

magnuskl commented 1 year ago

Other instances of this bug seem to be present elsewhere in the code, producing the same error. For instance see, see line 1030, also in wc-gateway-vipps-recurring.php.

Marcuzz commented 1 year ago

This should be fixed when feat/api-v3 is merged, as everything has been refactored to use classes in and out of the API now. I will finish that branch up shortly – it should already be fully working, although it is missing some error handling code and I don't want to make any guarantees yet.

For now I'll re-open this issue in-case it is still an issue somewhere within api-v3, which I will check soon. There may be places where we're grabbing data from WooCommerce where a class for the given resource is not yet instantiated

magnuskl commented 1 year ago

Sounds good. Thank you!

Marcuzz commented 1 year ago

Hi,

Can you try the newest version of the plugin? This shouldn't be an issue anymore, and I can't re-create it. Although I'd appreciate if you can check it out 😄

magnuskl commented 1 year ago

I do not see that error occurring in the PHP error logs anymore.