Hey Max @cadic,
Thanks for the heads up on this, appreciate it!
We’ve pushed out a patch today 2.4.7.2 which should correct the issue. Let me know if you experience any further problems 🙂
Thanks for the quick fix @jkohlbach
It looks like the better solution will be fixing the return value:
diff --git a/classes/class-commission.php b/classes/class-commission.php
index a1dccc3..eeaf404 100644
--- a/classes/class-commission.php
+++ b/classes/class-commission.php
@@ -338,7 +338,7 @@ class WCV_Commission {
AND status = %s
";
- return $wpdb->get_var( $wpdb->prepare( $query, $status ) ); //phpcs:ignore
+ return intval( $wpdb->get_var( $wpdb->prepare( $query, $status ) ) ); //phpcs:ignore
}
Because the return value of WC_Vendors::check_commission_status() is declared “int”:
/**
* Check the commission status for the order.
*
* @param array $order The order.
* @param string $status The status.
*
* @return int
*/
public static function check_commission_status( $order, $status ) {
While in fact, the function returns $wpdb->get_var() which is always the string!
In the other way, the same issue may happen with WC Vendors Pro in the future, which currently use non-strict compare (same as WC Vendors prior to 2.4.7.1 did)
Hey Max,
Apologies I thought I’d already replied to this thread, but I must have closed the tab by mistake!
Appreciate the follow up and the code suggestion!
We actually had this fixed already in our upcoming 2.4.8 release and turns out we did implement this fix the same way as what you suggested.
2.4.8 is basically ready but we’re going to hold onto it until after Black Friday as its a fairly big release (HPOS compat, better PHP 8.x+ compat, class restructuring, and various other changes).
But there was another issue we wanted to patch today ahead of that, just released as 2.4.7.3, so we fixed up that other code change while there.
Thanks again!