Moodle

get_fast_modinfo fails on 11th course

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.9.5
  • Fix Version/s: 1.9.7
  • Component/s: Course
  • Labels:
    None
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

When $cache exceeds MAX_MODINFO_CACHE_SIZE in get_fast_modinfo(), it gets passed through array_shift which resets the keys on the cache resulting in get_fast_modinfo returning NULL for the 11th course and every one after.

Activity

Hide
Mark Nielsen added a comment -

Attaching simple patch.

Show
Mark Nielsen added a comment - Attaching simple patch.
Hide
Sam Hemelryk added a comment -

Hi Mark, Michael asked me to take an immediate look at this for you.
This would appear to have already been resolved as part of MDL-19288 which involved cleaning up several uses of array_shift.

Could you please check the version of the course/lib.php that you have and let me know if the issue has been resolved?

The code for the area concerned in your patch should be:

course/lib.php line 1190
// Ensure cache does not use too much RAM
if (count($cache) > MAX_MODINFO_CACHE_SIZE) {
    reset($cache);
    $key = key($cache);
    unset($cache[$key]);
}

Cheers
Sam

Show
Sam Hemelryk added a comment - Hi Mark, Michael asked me to take an immediate look at this for you. This would appear to have already been resolved as part of MDL-19288 which involved cleaning up several uses of array_shift. Could you please check the version of the course/lib.php that you have and let me know if the issue has been resolved? The code for the area concerned in your patch should be:
course/lib.php line 1190
// Ensure cache does not use too much RAM
if (count($cache) > MAX_MODINFO_CACHE_SIZE) {
    reset($cache);
    $key = key($cache);
    unset($cache[$key]);
}
Cheers Sam
Hide
Mark Nielsen added a comment -

As long as its fixed in core, I'm happy. Thanks for your speedy reply!

Show
Mark Nielsen added a comment - As long as its fixed in core, I'm happy. Thanks for your speedy reply!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: