Fix non-numeric errors in PHP 7.1

This commit is contained in:
Brian Miyaji
2017-01-15 10:01:25 +11:00
parent 896741ccb8
commit da12f410fb
6 changed files with 31 additions and 10 deletions

View File

@@ -196,6 +196,7 @@ class SP_Player_List extends SP_Custom_Post {
if ( is_array( $player_league_season_stats ) ):
foreach ( $player_league_season_stats as $key => $value ):
$current_value = sp_array_value( sp_array_value( $placeholders, $player_id, array() ), $key, 0 );
$value = floatval( $value );
$placeholders[ $player_id ][ $key ] = $current_value + $value;
endforeach;
endif;
@@ -303,6 +304,7 @@ class SP_Player_List extends SP_Custom_Post {
endif;
endforeach;
elseif ( array_key_exists( $key, $totals[ $player_id ] ) ):
$value = floatval( $value );
$totals[ $player_id ][ $key ] += $value;
endif;
endforeach;
@@ -384,7 +386,7 @@ class SP_Player_List extends SP_Custom_Post {
// Add to total
$value = sp_array_value( $totals[ $player_id ], $result_slug . 'for', 0 );
$value += $team_result;
$value += floatval( $team_result );
$totals[ $player_id ][ $result_slug . 'for' ] = $value;
// Add subset
@@ -401,7 +403,7 @@ class SP_Player_List extends SP_Custom_Post {
// Add to total
$value = sp_array_value( $totals[ $player_id ], $result_slug . 'against', 0 );
$value += $team_result;
$value += floatval( $team_result );
$totals[ $player_id ][ $result_slug . 'against' ] = $value;
// Add subset