diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2017-04-18 08:36:29 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2017-04-18 08:38:13 +0200 |
commit | 6090c2ae8b6b33af79cae2ed63ebe5209d0729b3 (patch) | |
tree | c24ad4dabdf1b2a31a2405eb4c33665048bf35f8 /web | |
parent | 5553d01ab362e7731da0bb238cc188faacdd3d7e (diff) | |
download | aur-6090c2ae8b6b33af79cae2ed63ebe5209d0729b3.tar.gz aur-6090c2ae8b6b33af79cae2ed63ebe5209d0729b3.tar.xz |
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 <lfleischer@archlinux.org>
Diffstat (limited to 'web')
-rw-r--r-- | web/lib/acctfuncs.inc.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 3c8f9edb..22b3ca8d 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -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"); |