From 72b83b55e5e877aef0e361f0149472d794667e54 Mon Sep 17 00:00:00 2001 From: vga256 Date: Wed, 5 Jul 2023 21:07:45 -0600 Subject: [PATCH] search.php: - prevent script crash when usort() is performed on an empty database result, when using full-body search --- Rocksolid_Light/rocksolid/search.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Rocksolid_Light/rocksolid/search.php b/Rocksolid_Light/rocksolid/search.php index 9d2f7da..4e4c108 100644 --- a/Rocksolid_Light/rocksolid/search.php +++ b/Rocksolid_Light/rocksolid/search.php @@ -286,9 +286,14 @@ function get_body_search($group, $terms) { } $dbh = null; } - usort($overview, function($a, $b) { - return $a['rank'] <=> $b['rank']; - }); + // do not perform a usort of an empty search result + if ($overview != null) + { + usort($overview, + function($a, $b) { + return $a['rank'] <=> $b['rank']; + }); + } return $overview; }