From bdc418d1f99738d45b2a0e4fab07c974d5b58681 Mon Sep 17 00:00:00 2001
From: Arthur Schiwon <blizzz@owncloud.com>
Date: Thu, 20 Mar 2014 10:59:58 +0100
Subject: var count is assigned in the inner loop so it must be checked inside
 there to be properly used as part of the exit condition of the outer loop

---
 apps/user_ldap/lib/access.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'apps')

diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 1af993677cd..d135ee5b735 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -786,6 +786,7 @@ class Access extends LDAPUtility {
 		$cr = $this->connection->getConnectionResource();
 
 		do {
+			$continue = false;
 			$search = $this->executeSearch($filter, $base, $attr,
 										   $limit, $offset);
 			if($search === false) {
@@ -798,12 +799,15 @@ class Access extends LDAPUtility {
 				if($count !== false) {
 					$counter += $count;
 				}
+				if($count === $limit) {
+					$continue = true;
+				}
 			}
 
 			$this->processPagedSearchStatus($sr, $filter, $base, $count, $limit,
 										$offset, $pagedSearchOK, $skipHandling);
 			$offset += $limit;
-		} while($count === $limit);
+		} while($continue);
 
 		return $counter;
 	}
-- 
cgit v1.2.3