From 9e54d51a8ebde607c4085bdbad48b04e09e356d8 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sat, 23 Feb 2008 14:08:27 +0100
Subject: [PATCH] mysql auth backend: check DB query result correctly FS#1039

darcs-hash:20080223130827-7ad00-3c9ba32b002a34548df1696a26bd92616e763ccc.gz
---
 inc/auth/mysql.class.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/inc/auth/mysql.class.php b/inc/auth/mysql.class.php
index 9bb9fa1df..ebc3df902 100644
--- a/inc/auth/mysql.class.php
+++ b/inc/auth/mysql.class.php
@@ -489,7 +489,7 @@ class auth_mysql extends auth_basic {
         $sql = str_replace('%{user}',$this->_escape($user),$this->cnf['getGroups']);
         $result = $this->_queryDB($sql);
 
-        if(count($result)) {
+        if($result !== false && count($result)) {
           foreach($result as $row)
             $groups[] = $row['group'];
         }
@@ -610,7 +610,7 @@ class auth_mysql extends auth_basic {
     function _getUserInfo($user){
       $sql = str_replace('%{user}',$this->_escape($user),$this->cnf['getUserInfo']);
       $result = $this->_queryDB($sql);
-      if(count($result)) {
+      if($result !== false && count($result)) {
         $info = $result[0];
         $info['grps'] = $this->_getGroups($user);
         return $info;
-- 
GitLab