Skip to content

Commit

Permalink
MDL-40947: Fix segmentation fault issue in get_fast_modinfo.
Browse files Browse the repository at this point in the history
  • Loading branch information
kabalin committed Aug 2, 2013
1 parent bdd045c commit b2b2c13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/modinfolib.php
Expand Up @@ -1396,8 +1396,10 @@ function get_fast_modinfo($courseorid, $userid = 0, $resetonly = false) {
if (count($cache) > MAX_MODINFO_CACHE_SIZE) {
reset($cache);
$key = key($cache);
unset($cache[$key]->instances);
unset($cache[$key]->cms);
// Unsetting static variable in PHP is percular, it removes the reference,
// but data remain in memory. Prior to unsetting, the varable needs to be
// set to empty to remove its remains from memory.
$cache[$key] = '';
unset($cache[$key]);
}

Expand Down

0 comments on commit b2b2c13

Please sign in to comment.