From ed64e69ed1d860b9a3ebefe06bf44034760c48c8 Mon Sep 17 00:00:00 2001 From: sect Date: Fri, 13 Dec 2024 11:51:49 +0900 Subject: [PATCH] fix: prevent null order parameter in spreadsheet table sorting - Add null coalescing operator to handle null order parameter - Set default order to 'DESC' when order is not specified - Validate and sanitize order parameter before use - Improve code readability and prevent potential TypeError --- admin/class-recursivetable.php | 1 + 1 file changed, 1 insertion(+) diff --git a/admin/class-recursivetable.php b/admin/class-recursivetable.php index 7b38311..279905e 100644 --- a/admin/class-recursivetable.php +++ b/admin/class-recursivetable.php @@ -185,6 +185,7 @@ ); // Sort column validation. + $order = $order ?? $default_order; $orderby = isset( $allowed_orderby[ $orderby ] ) ? $orderby : $default_orderby; $order = in_array( strtoupper( $order ), array( 'ASC', 'DESC' ), true ) ? strtoupper( $order ) : $default_order;