From 26e827eb3eba69924bba4033f60456d3470a130c Mon Sep 17 00:00:00 2001 From: Vedanshu Jain Date: Wed, 19 Apr 2023 16:04:34 +0530 Subject: [PATCH] Add null protection. --- .../src/Internal/DataStores/Orders/OrdersTableQuery.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php b/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php index 7ab112fa06d..c32067e36b9 100644 --- a/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php +++ b/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php @@ -316,6 +316,11 @@ class OrdersTableQuery { * @throws \Exception When date args are invalid. */ private function process_date_args(): void { + if ( $this->arg_isset( 'date_query' ) ) { + // Process already passed date queries args. + $this->args['date_query'] = $this->map_gmt_and_post_keys_to_hpos_keys( $this->args['date_query'] ); + } + $valid_operators = array( '>', '>=', '=', '<=', '<', '...' ); $date_queries = array(); $local_to_gmt_date_keys = array( @@ -331,9 +336,6 @@ class OrdersTableQuery { $valid_date_keys = array_merge( $gmt_date_keys, $local_date_keys ); $date_keys = array_filter( $valid_date_keys, array( $this, 'arg_isset' ) ); - // Process already passed date queries args. - $this->args['date_query'] = $this->map_gmt_and_post_keys_to_hpos_keys( $this->args['date_query'] ); - foreach ( $date_keys as $date_key ) { $date_value = $this->args[ $date_key ]; $operator = '=';