From 8051891776ed644e1d7e8f8948850c8b04b07a45 Mon Sep 17 00:00:00 2001
From: chris <chris@jalakai.co.uk>
Date: Fri, 4 Aug 2006 01:12:53 +0200
Subject: [PATCH] fix for php5's more stringent type checking in foreach
 (auth/mysql.class.php)

as described at http://wiki.splitbrain.org/wiki:auth:mysql#using_mysql_5

darcs-hash:20060803231253-9b6ab-bbf06ef1e9141c5ec1d3c79dad7f88481296ad8b.gz
---
 inc/auth/mysql.class.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/inc/auth/mysql.class.php b/inc/auth/mysql.class.php
index da89dd845..aea11d35f 100644
--- a/inc/auth/mysql.class.php
+++ b/inc/auth/mysql.class.php
@@ -342,9 +342,11 @@ class auth_mysql extends auth_basic {
         $sql .= " ".$this->cnf['SortOrder']." LIMIT $first, $limit";
         $result = $this->_queryDB($sql);
 
-        foreach ($result as $user)
-          if (($info = $this->_getUserInfo($user['user'])))
-            $out[$user['user']] = $info;
+        if (!empty($result)) {
+          foreach ($result as $user)
+            if (($info = $this->_getUserInfo($user['user'])))
+              $out[$user['user']] = $info;
+        }
 
         $this->_unlockTables();
         $this->_closeDB();
-- 
GitLab