MDL-40947: Fix segmentation fault issue in get_fast_modinfo.

This commit is contained in:
Ruslan Kabalin
2013-08-06 17:42:08 +12:00
committed by Sam Hemelryk
parent aca4d181b9
commit f327285ab3
+4 -2
View File
@@ -1414,8 +1414,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]);
}