]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix count on string
authorDaniel Kesselberg <mail@danielkesselberg.de>
Sat, 24 Nov 2018 21:06:45 +0000 (22:06 +0100)
committerBackportbot <backportbot-noreply@rullzer.com>
Tue, 27 Nov 2018 13:16:26 +0000 (13:16 +0000)
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
apps/user_ldap/lib/Access.php

index fb2582e82662f0873336b0cd13b4dac5c19dd138..c5075a033b6783e6d92ec62bad23240bf3bd97d5 100644 (file)
@@ -879,7 +879,7 @@ class Access extends LDAPUtility {
                        });
                }
                $this->batchApplyUserAttributes($recordsToUpdate);
-               return $this->fetchList($ldapRecords, count($attr) > 1);
+               return $this->fetchList($ldapRecords, $this->manyAttributes($attr));
        }
 
        /**
@@ -922,7 +922,7 @@ class Access extends LDAPUtility {
         * @return array
         */
        public function fetchListOfGroups($filter, $attr, $limit = null, $offset = null) {
-               return $this->fetchList($this->searchGroups($filter, $attr, $limit, $offset), count($attr) > 1);
+               return $this->fetchList($this->searchGroups($filter, $attr, $limit, $offset), $this->manyAttributes($attr));
        }
 
        /**
@@ -2011,4 +2011,17 @@ class Access extends LDAPUtility {
                return $pagedSearchOK;
        }
 
+       /**
+        * Is more than one $attr used for search?
+        *
+        * @param string|string[]|null $attr
+        * @return bool
+        */
+       private function manyAttributes($attr) {
+               if (\is_array($attr)) {
+                       return \count($attr) > 1;
+               }
+               return false;
+       }
+
 }