]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix getting group '0' from database backend
authorJoas Schilling <nickvergessen@gmx.de>
Mon, 4 Aug 2014 11:46:53 +0000 (13:46 +0200)
committerJoas Schilling <nickvergessen@gmx.de>
Mon, 4 Aug 2014 13:53:55 +0000 (15:53 +0200)
Fix #9972

lib/private/group/database.php
lib/private/group/manager.php

index baaf2cf273914259cb2e4322524293d0c1f87d27..8a6cb68753c55c57c25588c736e1860f85629f56 100644 (file)
@@ -185,7 +185,7 @@ class OC_Group_Database extends OC_Group_Backend {
        public function groupExists($gid) {
                $query = OC_DB::prepare('SELECT `gid` FROM `*PREFIX*groups` WHERE `gid` = ?');
                $result = $query->execute(array($gid))->fetchOne();
-               if ($result) {
+               if ($result !== false) {
                        return true;
                }
                return false;
index dae6443e9d488a61f80a756950e80ad80c273f04..bf0910463dcfbbfe37da008fc3d4f743293cde2d 100644 (file)
@@ -125,7 +125,7 @@ class Manager extends PublicEmitter {
         * @return \OC\Group\Group
         */
        public function createGroup($gid) {
-               if (!$gid) {
+               if ($gid === '' || is_null($gid)) {
                        return false;
                } else if ($group = $this->get($gid)) {
                        return $group;