Add null protection.

This commit is contained in:
Vedanshu Jain 2023-04-19 16:04:34 +05:30
parent f58016e7d7
commit 26e827eb3e
1 changed files with 5 additions and 3 deletions

View File

@ -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 = '=';