]> 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)
committerThomas Müller <thomas.mueller@tmit.eu>
Wed, 6 Aug 2014 07:55:11 +0000 (09:55 +0200)
Fix #9972

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

index b7148f38fe34eb0d478cd0fd591bc6cd5e76eda0..8d6ea1f50a58668d76707dcb0740f81cd7689f64 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 3613c7547bdcb85e37a2b66841415c38d8b65133..2b07be4c332ecb590bf175e16800b52a4427a5c6 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;