Fixes possible fatal error in legacy report code (#38683)
This commit is contained in:
commit
81a5a435fc
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Handle possibly empty refund value in reports (PHP 8.1+).
|
|
@ -512,7 +512,7 @@ class WC_Admin_Report {
|
|||
}
|
||||
|
||||
if ( $data_key ) {
|
||||
$prepared_data[ $time ][1] += $d->$data_key;
|
||||
$prepared_data[ $time ][1] += is_numeric( $d->$data_key ) ? $d->$data_key : 0;
|
||||
} else {
|
||||
$prepared_data[ $time ][1] ++;
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
|||
);
|
||||
|
||||
foreach ( $this->report_data->partial_refunds as $key => $order ) {
|
||||
$this->report_data->partial_refunds[ $key ]->net_refund = $order->total_refund - ( $order->total_shipping + $order->total_tax + $order->total_shipping_tax );
|
||||
$this->report_data->partial_refunds[ $key ]->net_refund = (float) $order->total_refund - ( (float) $order->total_shipping + (float) $order->total_tax + (float) $order->total_shipping_tax );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue