Logging: Prevent fatal type error when submitting empty search (#41847)

This commit is contained in:
Leif Singer 2023-12-12 12:36:21 +01:00 committed by GitHub
commit 0a0351aa6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Prevent fatal error when submitting an empty search query on the log files screen.

View File

@ -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 );