From: skodak Date: Sat, 24 May 2008 20:43:33 +0000 (+0000) Subject: MDL-14679 fixed warning and change false to array() when no users found X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=dc10f119bbde5674a271f2262d133c3887fd7a74;p=moodle.git MDL-14679 fixed warning and change false to array() when no users found --- diff --git a/lib/accesslib.php b/lib/accesslib.php index b145508e5f..87c56ff2f4 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -4202,7 +4202,7 @@ function get_users_by_capability($context, $capability, $fields='', $sort='', $roleids = array_unique($roleids); if (count($roleids)===0) { // noone here! - return false; + return array(); } // is the default role interesting? does it have @@ -4641,9 +4641,9 @@ function has_capability_from_rarc($ras, $roleperms, $capability, $doanything) { $hascap[$cap]->perm += $rp->perm; } } - if ($hascap[$capability]->perm > 0 - || ($doanything && isset($hascap['moodle/site:candoanything']) - && $hascap['moodle/site:candoanything']->perm > 0)) { + if ((isset($hascap[$capability]->perm) and $hascap[$capability]->perm > 0) + or ($doanything and isset($hascap['moodle/site:candoanything']) + and $hascap['moodle/site:candoanything']->perm > 0)) { return true; } return false;