From 1c09b6836de66b0354fd5b6bdf865c8bacd94cdd Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Fri, 25 Jan 2019 13:14:41 +0100 Subject: [PATCH] Adjusted default return value when page is out of range. --- .../class-wc-admin-reports-taxes-stats-data-store.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-admin/includes/data-stores/class-wc-admin-reports-taxes-stats-data-store.php b/plugins/woocommerce-admin/includes/data-stores/class-wc-admin-reports-taxes-stats-data-store.php index 5dc32c70506..8231bee89e3 100644 --- a/plugins/woocommerce-admin/includes/data-stores/class-wc-admin-reports-taxes-stats-data-store.php +++ b/plugins/woocommerce-admin/includes/data-stores/class-wc-admin-reports-taxes-stats-data-store.php @@ -132,6 +132,14 @@ class WC_Admin_Reports_Taxes_Stats_Data_Store extends WC_Admin_Reports_Data_Stor $data = wp_cache_get( $cache_key, $this->cache_group ); if ( false === $data ) { + $data = (object) array( + 'totals' => (object) array(), + 'intervals' => (object) array(), + 'total' => 0, + 'pages' => 0, + 'page_no' => 0, + ); + $selections = $this->selected_columns( $query_args ); $totals_query = array(); $intervals_query = array(); @@ -155,7 +163,7 @@ class WC_Admin_Reports_Taxes_Stats_Data_Store extends WC_Admin_Reports_Data_Stor $total_pages = (int) ceil( $db_records_count / $intervals_query['per_page'] ); if ( $query_args['page'] < 1 || $query_args['page'] > $total_pages ) { - return array(); + return $data; } $totals = $wpdb->get_results(