diff --git a/plugins/woocommerce/changelog/fix-log-search-fatal b/plugins/woocommerce/changelog/fix-log-search-fatal new file mode 100644 index 00000000000..24a3cd99d44 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-log-search-fatal @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Prevent fatal error when submitting an empty search query on the log files screen. diff --git a/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php b/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php index cf184d65fe7..cb494422278 100644 --- a/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php +++ b/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php @@ -421,7 +421,7 @@ class FileController { */ public function search_within_files( string $search, array $args = array(), array $file_args = array(), bool $count_only = false ) { if ( '' === $search ) { - return array(); + return $count_only ? 0 : array(); } $search = esc_html( $search );