From 6b29066d3ed12b7b5a9c8a982b558f0f32a3ba24 Mon Sep 17 00:00:00 2001 From: Ramy Talal Date: Sun, 9 Apr 2017 13:45:46 +0200 Subject: [PATCH] Fix notice errors on PHP 7.1 --- includes/wc-term-functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/wc-term-functions.php b/includes/wc-term-functions.php index 5cd920851a8..586da7a583e 100644 --- a/includes/wc-term-functions.php +++ b/includes/wc-term-functions.php @@ -151,10 +151,13 @@ function wc_get_product_terms( $product_id, $taxonomy, $args = array() ) { * @return int */ function _wc_get_product_terms_name_num_usort_callback( $a, $b ) { - if ( $a->name + 0 === $b->name + 0 ) { + $aName = (int) $a->name; + $bName = (int) $b->name; + + if ( $aName === $bName ) { return 0; } - return ( $a->name + 0 < $b->name + 0 ) ? -1 : 1; + return ( $aName < $bName ) ? -1 : 1; } /**