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

@@ -335,6 +335,7 @@ class SP_Player extends SP_Custom_Post {
foreach ( $player_performance as $key => $value ):
if ( array_key_exists( $key, $totals ) ):
$value = floatval( $value );
$totals[ $key ] += $value;
endif;
endforeach;
@@ -416,7 +417,7 @@ class SP_Player extends SP_Custom_Post {
// Add to total
$value = sp_array_value( $totals, $result_slug . 'for', 0 );
$value += $team_result;
$value += floatval( $team_result );
$totals[ $result_slug . 'for' ] = $value;
// Add subset
@@ -432,7 +433,7 @@ class SP_Player extends SP_Custom_Post {
// Add to total
$value = sp_array_value( $totals, $result_slug . 'against', 0 );
$value += $team_result;
$value += floatval( $team_result );
$totals[ $result_slug . 'against' ] = $value;
// Add subset
@@ -659,6 +660,7 @@ class SP_Player extends SP_Custom_Post {
$totals = array();
foreach ( $merged as $season => $stats ) {
foreach ( $stats as $key => $value ) {
$value = floatval( $value );
$totals[ $key ] = sp_array_value( $totals, $key, 0 ) + $value;
}
}