Commit 6090c2ae authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Check query return value in search_results_page()



Instead of unconditionally calling fetch on the return value of query(),
error out early if the value evaluates to false. Also, make sure that
the results array is always initialized, even if the result set is
empty.

Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 5553d01a
......@@ -495,8 +495,11 @@ function search_results_page($O=0,$SB="",$U="",$T="",
$result = $dbh->query($q);
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$userinfo[] = $row;
$userinfo = array();
if ($result) {
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
$userinfo[] = $row;
}
}
include("account_search_results.php");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment