Merge pull request #29089 from woocommerce/fix/issue-29087

Type cast floats to prevent string addition errors in PHP 8 closes #2…
This commit is contained in:
Roy Ho 2021-02-10 19:16:53 -08:00 committed by GitHub
commit 986b4fe0b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1607,9 +1607,9 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {
$taxes = $item->get_taxes();
foreach ( $taxes['total'] as $tax_rate_id => $tax ) {
$tax_amount = $this->round_line_tax( $tax, false );
$tax_amount = (float) $this->round_line_tax( $tax, false );
$cart_taxes[ $tax_rate_id ] = isset( $cart_taxes[ $tax_rate_id ] ) ? $cart_taxes[ $tax_rate_id ] + $tax_amount : $tax_amount;
$cart_taxes[ $tax_rate_id ] = isset( $cart_taxes[ $tax_rate_id ] ) ? (float) $cart_taxes[ $tax_rate_id ] + $tax_amount : $tax_amount;
}
}