Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.9
-
Fix Version/s: None
-
Component/s: General, Roles / Access
-
Labels:None
-
Environment:MySQL 5.0.37, PHP 5.1.4, Windows Server 2003
-
Database:MySQL
-
Affected Branches:MOODLE_19_STABLE
Description
in accesslib.php at approximately line 1268:
$sql = "SELECT sctx.path, ra.roleid,
ctx.path AS parentpath,
rco.capability, rco.permission
FROM {$CFG->prefix}role_assignments ra
JOIN {$CFG->prefix}context ctx
ON ra.contextid=ctx.id
JOIN {$CFG->prefix}context sctx
ON (sctx.path LIKE " . sql_concat('ctx.path',"'/%'"). " )
JOIN {$CFG->prefix}role_capabilities rco
ON (rco.roleid=ra.roleid AND rco.contextid=sctx.id)
WHERE ra.userid = $userid
AND sctx.contextlevel <= ".CONTEXT_COURSE."
ORDER BY sctx.depth, sctx.path, ra.roleid";
$rs = get_recordset_sql($sql);
When attempting to upgrade a site from 1.8.2+ to 1.9 beta 2 I found that here get_recordset_sql($sql) is returning false. This causes fatal "Call to a member function on a non-object" errors in the code that follows.
My niave fix was to try wrapping this code in an if block,
if ($rs) {
while ($rd = rs_fetch_next_record($rs)) {
$k = "{$rd->path}:{$rd->roleid}";
$accessdata['rdef'][$k][$rd->capability] = $rd->permission;
}
unset($rd);
rs_close($rs);
}
This allowed the upgrade to proceed, however I also encountered a couple of "You don't have permission to do this" style errors along the way, which leads me to believe my "solution" is not the way forward ![]()
Do you have any 3rd party modules installed? Or any hacks?