Skip to content

Commit

Permalink
MDL-19288 fixed limiting cached context - array_shift() was breaking …
Browse files Browse the repository at this point in the history
…array keys; merged from MOODLE_19_STABLE
  • Loading branch information
skodak committed May 23, 2009
1 parent 074d3e8 commit 56f3599
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/accesslib.php
Expand Up @@ -235,7 +235,8 @@ function cache_context($context) {
// If there are too many items in the cache already, remove items until
// there is space
while (count($ACCESSLIB_PRIVATE->contextsbyid) >= MAX_CONTEXT_CACHE_SIZE) {
$first = array_shift($ACCESSLIB_PRIVATE->contextsbyid);
$first = reset($ACCESSLIB_PRIVATE->contextsbyid);
unset($ACCESSLIB_PRIVATE->contextsbyid[$first->id]);
unset($ACCESSLIB_PRIVATE->contexts[$first->contextlevel][$first->instanceid]);
}

Expand Down

0 comments on commit 56f3599

Please sign in to comment.