While working on
MDL-20045, I noticed a couple of bugs in the current accesslib.php in Moodle 2.0:
- get_child_contexts sometimes returns a record set instead of an array, which is what the documentation states it is. This breaks get_role_context_caps, since it passes the return value of get_child_contexts to array_keys. In addition, the record set has already been iterated through, and cannot be rewound. (In Moodle 1.9, the record sets were copied to an array, and the array was returned).
- fetch_context_capabilities for blocks and modules searches for records that have the component equal to "block/..." and "mod/..." respectively. However in Moodle 2.0, the format seems to have been changed to "block_..." and "mod_...". ("_" instead of "/".)