FIX: PHP 8.0: Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero

This commit is contained in:
savvasha
2021-09-26 16:15:04 +03:00
parent 6edd62ff11
commit 12ab5579a9
2 changed files with 4 additions and 2 deletions

View File

@@ -831,7 +831,7 @@ class SP_League_Table extends SP_Secondary_Post {
// Flip value if descending order
if ( $priority['order'] == 'DESC' ) $output = 0 - $output;
return ( $output > 0 );
return ( $output > 0 ? 1 : -1 );
endif;

View File

@@ -1482,7 +1482,9 @@ if ( ! function_exists( 'sp_sort_terms' ) ) {
$b = intval( $b );
$b = get_term( $b );
}
return get_term_meta( $a->term_id, 'sp_order', true ) > get_term_meta( $b->term_id, 'sp_order', true );
$term_meta_a = get_term_meta( $a->term_id, 'sp_order', true );
$term_meta_b = get_term_meta( $b->term_id, 'sp_order', true );
return $term_meta_a == $term_meta_b ? 0 : ($term_meta_a > $term_meta_b ? 1 : -1);
}
}