buckaroo-it / WooCommerce

Repository containing the WooCommerce Payment Plugin by Buckaroo
2 stars 3 forks source link

fix: check on empty string in roundAmount #236

Closed omnisite closed 3 months ago

omnisite commented 3 months ago

If an empty string is passed to roundAmount() it triggers a critical: CRITICAL Uncaught TypeError: number_format(): Argument #1 ($num) must be of type float, string given in /mnt/efs/zwijsen/current/public/app/plugins/wc-buckaroo-bpe-gateway/library/common.php:880

In our case an emptt tax amount -> plugins/wc-buckaroo-bpe-gateway/includes/admin/meta-boxes/views/html-order-shipping.php(96): roundAmount()

So I added an extra check.

harli91 commented 3 months ago

the error originates in line 880 number_format($amount, 2, '.', ''); about variable $amount that is not a float number so I think we should fix it there

vegimcarkaxhija commented 3 months ago

Hi @omnisite, thank you for pointing out that the issue has already been fixed in PR #237. Based on that, I'm closing this pull request as it's no longer needed. Appreciate the feedback!