Check if package rates is an array before filtering on it (https://github.com/woocommerce/woocommerce-blocks/pull/9351)

Co-authored-by: Niels Lange <info@nielslange.de>
This commit is contained in:
Thomas Roberts 2023-05-22 12:43:00 +03:00 committed by GitHub
parent 5457145c6a
commit 56879a4861
1 changed files with 4 additions and 0 deletions

View File

@ -460,6 +460,10 @@ class ShippingController {
if ( count( $valid_packages ) !== count( $packages ) ) {
$packages = array_map(
function( $package ) {
if ( ! is_array( $package['rates'] ) ) {
$package['rates'] = [];
return $package;
}
$package['rates'] = array_filter(
$package['rates'],
function( $rate ) {