Permalink
Browse files

MDL-40947: Fix segmentation fault issue in get_fast_modinfo.

  • Loading branch information...
1 parent b4b5081 commit 5878abf8c6a81accdca949517abf98af0ebc3ac8 @kabalin kabalin committed with Sam Hemelryk Jul 31, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/modinfolib.php
View
@@ -1362,8 +1362,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]);
}

0 comments on commit 5878abf

Please sign in to comment.