Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 1.9.3
-
Fix Version/s: None
-
Component/s: Roles / Access
-
Labels:None
-
Affected Branches:MOODLE_19_STABLE
Description
I am looking at line 1313 of accesslib.php, the bit following the comment "// Read in the RAs, preventing duplicates" in load_subcontext. In the case where you are call this with a course context, the the role assignments for this context level are already loaded, but the code does not check for this. Therefore I am seeing things like this:
Array
(
[ra] => Array
(
[/1/3/49] => Array
(
[0] => 3
)
[/1/3/48/20] => Array
(
[0] => 3
[1] => 3
)
[/1] => Array
(
[0] => 7
)
[/1/2] => Array
(
[0] => 5
)
)
This does not hurt, apart from, perhaps, causing wasted effort later - except that some display code I have just written does not like this.
I am thinking of adding a array_unique call to fix this.
This patch seems to fix the problem. Please could you review it. Thanks.