From 8d7c93061b9e948b63e3fd882ecd9c0ced5bf6ba Mon Sep 17 00:00:00 2001 From: timoj Date: Tue, 25 Jan 2022 20:25:38 +0100 Subject: [PATCH 1/3] explicit cast to int and float --- includes/wcwuunder-create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wcwuunder-create.php b/includes/wcwuunder-create.php index 08286da..ee58ff9 100644 --- a/includes/wcwuunder-create.php +++ b/includes/wcwuunder-create.php @@ -533,7 +533,7 @@ public function wcwp_get_order_items($order_id) break; } - $data['total_weight'] = $data['quantity'] * $data['weight']; + $data['total_weight'] = intval($data['quantity']) * floatval($data['weight']); // Set item dimensions $data['dimensions'] = wc_format_dimensions($product->get_dimensions(false)); From 3b65099ae3fb4b91dfbb208a5ba34d8bd74e0e15 Mon Sep 17 00:00:00 2001 From: timoj Date: Wed, 2 Feb 2022 10:44:41 +0100 Subject: [PATCH 2/3] added explicit final cast to int --- includes/wcwuunder-create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wcwuunder-create.php b/includes/wcwuunder-create.php index ee58ff9..d4e1425 100644 --- a/includes/wcwuunder-create.php +++ b/includes/wcwuunder-create.php @@ -533,7 +533,7 @@ public function wcwp_get_order_items($order_id) break; } - $data['total_weight'] = intval($data['quantity']) * floatval($data['weight']); + $data['total_weight'] = intval(intval($data['quantity']) * floatval($data['weight'])); // Set item dimensions $data['dimensions'] = wc_format_dimensions($product->get_dimensions(false)); From 0df3a189f3dd72214b27adf1ac38eeead8fd6427 Mon Sep 17 00:00:00 2001 From: timoj Date: Fri, 4 Feb 2022 14:12:19 +0100 Subject: [PATCH 3/3] upd version --- CHANGELOG.md | 6 ++++++ includes/wcwuunder-create.php | 2 +- woocommerce-wuunder.php | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ba434d..63d8ba6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ## Released +## [2.7.22](https://github.com/wuunder/wuunder-webshopplugin-woocommerce/tag/2.7.22) - 2022-02-04 + +### Fixed + +- Fix weight calculation by explicit casting vars + ## [2.7.20](https://github.com/wuunder/wuunder-webshopplugin-woocommerce/tag/2.7.20) - 2020-12-11 ### Fixed diff --git a/includes/wcwuunder-create.php b/includes/wcwuunder-create.php index d4e1425..6f58fde 100644 --- a/includes/wcwuunder-create.php +++ b/includes/wcwuunder-create.php @@ -13,7 +13,7 @@ public function __construct() $this->version_obj = array( 'product' => 'Woocommerce extension', 'version' => array( - 'build' => '2.7.21', + 'build' => '2.7.22', 'plugin' => '2.0'), 'platform' => array( 'name' => 'Woocommerce', diff --git a/woocommerce-wuunder.php b/woocommerce-wuunder.php index fca2d8f..4c3110e 100644 --- a/woocommerce-wuunder.php +++ b/woocommerce-wuunder.php @@ -3,7 +3,7 @@ * Plugin Name: Wuunder for-woocommerce * Plugin URI: https://wearewuunder.com/wuunder-voor-webshops/ * Description: Wuunder shipping plugin - * Version: 2.7.21 + * Version: 2.7.22 * Author: Wuunder * Author URI: http://wearewuunder.com */ @@ -57,7 +57,7 @@ class Woocommerce_Wuunder { public static $plugin_path; public static $plugin_basename; - const VERSION = '2.7.21'; + const VERSION = '2.7.22'; public function __construct() {